CPU Use
This commit is contained in:
+3
-1
@@ -23,7 +23,9 @@
|
|||||||
/* Maximum filesize to allow when uploading */
|
/* Maximum filesize to allow when uploading */
|
||||||
"maxUploadSize": 1048576,
|
"maxUploadSize": 1048576,
|
||||||
|
|
||||||
/* Provide access point capture redirects on this gateway. -- provides automatic browser launching on Access Point access. */
|
/* Provide access point capture redirects on this gateway. -- provides automatic browser launching on Access Point access.
|
||||||
|
(not implemented)
|
||||||
|
*/
|
||||||
"accessPointGateway": "172.24.1.0/24",
|
"accessPointGateway": "172.24.1.0/24",
|
||||||
"accessPointServerAddress": "172.24.1.1"
|
"accessPointServerAddress": "172.24.1.1"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
/* Maximum filesize to allow when uploading */
|
/* Maximum filesize to allow when uploading */
|
||||||
"maxUploadSize": 1048576,
|
"maxUploadSize": 1048576,
|
||||||
|
|
||||||
/* Provide access point capture redirects on this gateway. */
|
/* Provide access point capture redirects on this gateway. (not implemented) */
|
||||||
"accessPointGateway": "192.168.0.0/24",
|
"accessPointGateway": "192.168.0.0/24",
|
||||||
"accessPointServerAddress" : "192.168.0.26:8080"
|
"accessPointServerAddress" : "192.168.0.26:8080"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"socket_server_port": 80,
|
"socket_server_port": 8080,
|
||||||
"socket_server_address": "*",
|
"socket_server_address": "*",
|
||||||
|
|
||||||
"max_upload_size": 1048576,
|
"max_upload_size": 1048576,
|
||||||
|
|||||||
@@ -26,24 +26,45 @@ const GREEN_COLOR = "#666";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function tempDisplay(mC: number): string
|
function tempDisplay(mC: number): string {
|
||||||
{
|
|
||||||
return (mC / 1000).toFixed(1) + "\u00B0C"; // degrees C.
|
return (mC / 1000).toFixed(1) + "\u00B0C"; // degrees C.
|
||||||
}
|
}
|
||||||
function cpuDisplay(cpu: number): string
|
function cpuDisplay(cpu: number): string {
|
||||||
{
|
|
||||||
return cpu.toFixed(1) + "%";
|
return cpu.toFixed(1) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class JackHostStatus {
|
function fmtCpuFreq(freq: number): string
|
||||||
deserialize(input: any): JackHostStatus
|
|
||||||
{
|
{
|
||||||
|
if (freq >= 100000000)
|
||||||
|
{
|
||||||
|
return (freq/1000000).toFixed(1) + " GHz";
|
||||||
|
}
|
||||||
|
if (freq >= 10000000)
|
||||||
|
{
|
||||||
|
return (freq/1000000).toFixed(2) + " GHz";
|
||||||
|
}
|
||||||
|
if (freq >= 1000000)
|
||||||
|
{
|
||||||
|
return (freq/1000000).toFixed(3) + " GHz";
|
||||||
|
}
|
||||||
|
if (freq >= 1000)
|
||||||
|
{
|
||||||
|
return (freq/1000).toFixed(3) + " MHz";
|
||||||
|
}
|
||||||
|
return freq + " KHz";
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class JackHostStatus {
|
||||||
|
deserialize(input: any): JackHostStatus {
|
||||||
this.active = input.active;
|
this.active = input.active;
|
||||||
this.restarting = input.restarting;
|
this.restarting = input.restarting;
|
||||||
this.underruns = input.underruns;
|
this.underruns = input.underruns;
|
||||||
this.cpuUsage = input.cpuUsage;
|
this.cpuUsage = input.cpuUsage;
|
||||||
this.msSinceLastUnderrun = input.msSinceLastUnderrun;
|
this.msSinceLastUnderrun = input.msSinceLastUnderrun;
|
||||||
this.temperaturemC = input.temperaturemC;
|
this.temperaturemC = input.temperaturemC;
|
||||||
|
this.cpuFreqMax = input.cpuFreqMax;
|
||||||
|
this.cpuFreqMin = input.cpuFreqMin;
|
||||||
|
this.governor = input.governor;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
hasTemperature(): boolean {
|
hasTemperature(): boolean {
|
||||||
@@ -55,7 +76,35 @@ export default class JackHostStatus {
|
|||||||
cpuUsage: number = 0;
|
cpuUsage: number = 0;
|
||||||
msSinceLastUnderrun: number = -5000 * 1000;
|
msSinceLastUnderrun: number = -5000 * 1000;
|
||||||
temperaturemC: number = -1000000;
|
temperaturemC: number = -1000000;
|
||||||
|
cpuFreqMax: number = 0;
|
||||||
|
cpuFreqMin: number = 0;
|
||||||
|
governor: string = "";
|
||||||
|
|
||||||
|
static getCpuInfo(label: string, status?: JackHostStatus): React.ReactNode {
|
||||||
|
if (!status) {
|
||||||
|
return (<div style={{ whiteSpace: "nowrap" }}>
|
||||||
|
<Typography variant="caption" color="textSecondary">{label}</Typography>
|
||||||
|
<Typography variant="caption"> </Typography>
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
return (<div style={{ whiteSpace: "nowrap" }}>
|
||||||
|
<Typography variant="caption" color="textSecondary">{label}</Typography>
|
||||||
|
<Typography variant="caption" color="textSecondary">
|
||||||
|
{
|
||||||
|
(status.cpuFreqMax === status.cpuFreqMin)?
|
||||||
|
(
|
||||||
|
<span> {fmtCpuFreq(status.cpuFreqMax)} {status.governor} </span>
|
||||||
|
)
|
||||||
|
:(
|
||||||
|
<span> {fmtCpuFreq(status.cpuFreqMax)}-{fmtCpuFreq(status.cpuFreqMax)} {status.governor} </span>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</Typography>
|
||||||
|
</div>);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
static getDisplayView(label: string, status?: JackHostStatus): React.ReactNode {
|
static getDisplayView(label: string, status?: JackHostStatus): React.ReactNode {
|
||||||
if (!status) {
|
if (!status) {
|
||||||
return (<div style={{ whiteSpace: "nowrap" }}>
|
return (<div style={{ whiteSpace: "nowrap" }}>
|
||||||
@@ -63,8 +112,7 @@ export default class JackHostStatus {
|
|||||||
<Typography variant="caption"> </Typography>
|
<Typography variant="caption"> </Typography>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
if (status.restarting)
|
if (status.restarting) {
|
||||||
{
|
|
||||||
return (
|
return (
|
||||||
<div style={{ whiteSpace: "nowrap" }}>
|
<div style={{ whiteSpace: "nowrap" }}>
|
||||||
<Typography variant="caption" color="textSecondary">{label}</Typography>
|
<Typography variant="caption" color="textSecondary">{label}</Typography>
|
||||||
@@ -79,7 +127,6 @@ export default class JackHostStatus {
|
|||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -164,10 +164,8 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleConnectionStateChanged(): void {
|
handleConnectionStateChanged(): void {
|
||||||
if (this.model.state.get() === State.Ready)
|
if (this.model.state.get() === State.Ready) {
|
||||||
{
|
if (this.state.shuttingDown || this.state.restarting) {
|
||||||
if (this.state.shuttingDown || this.state.restarting)
|
|
||||||
{
|
|
||||||
this.setState({ shuttingDown: false, restarting: false });
|
this.setState({ shuttingDown: false, restarting: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,14 +418,21 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
|||||||
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">
|
<Typography className={classes.sectionHead} display="block" variant="caption" color="secondary">
|
||||||
AUDIO
|
AUDIO
|
||||||
</Typography>
|
</Typography>
|
||||||
<div style={{ paddingLeft: 48, position: "relative", top: -12 }}>
|
|
||||||
{(!isConfigValid) ?
|
{(!isConfigValid) ?
|
||||||
(
|
(
|
||||||
<Typography variant="caption" color="textSecondary">Status: <span style={{color: "#F00"}}>Not configured.</span></Typography>
|
<div style={{ paddingLeft: 48, position: "relative", top: -12 }}>
|
||||||
):
|
<Typography display="block" variant="caption" color="textSecondary">Status: <span style={{ color: "#F00" }}>Not configured.</span></Typography>
|
||||||
JackHostStatus.getDisplayView("Status:\u00A0", this.state.jackStatus)
|
<Typography display="block" variant="caption" color="textSecondary">CPU: </Typography>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
) :
|
||||||
|
(
|
||||||
|
<div style={{ paddingLeft: 48, position: "relative", top: -12 }}>
|
||||||
|
{JackHostStatus.getDisplayView("Status:\u00A0", this.state.jackStatus)}
|
||||||
|
{JackHostStatus.getCpuInfo("CPU:\u00A0", this.state.jackStatus)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
{this.state.jackConfiguration.errorState !== "" &&
|
{this.state.jackConfiguration.errorState !== "" &&
|
||||||
(
|
(
|
||||||
<div style={{ paddingLeft: 48, position: "relative", top: -12 }}>
|
<div style={{ paddingLeft: 48, position: "relative", top: -12 }}>
|
||||||
@@ -449,7 +454,8 @@ const SettingsDialog = withStyles(styles, { withTheme: true })(
|
|||||||
jackServerSettings={this.state.jackServerSettings}
|
jackServerSettings={this.state.jackServerSettings}
|
||||||
onClose={() => this.setState({ showJackServerSettingsDialog: false })}
|
onClose={() => this.setState({ showJackServerSettingsDialog: false })}
|
||||||
onApply={(jackServerSettings) => {
|
onApply={(jackServerSettings) => {
|
||||||
this.setState({ showJackServerSettingsDialog: false,
|
this.setState({
|
||||||
|
showJackServerSettingsDialog: false,
|
||||||
jackServerSettings: jackServerSettings
|
jackServerSettings: jackServerSettings
|
||||||
});
|
});
|
||||||
this.model.setJackServerSettings(jackServerSettings);
|
this.model.setJackServerSettings(jackServerSettings);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ const ZoomedDial = withStyles(styles, { withTheme: true })(
|
|||||||
let instanceId = this.props.controlInfo.instanceId;
|
let instanceId = this.props.controlInfo.instanceId;
|
||||||
if (instanceId === -1) return 0;
|
if (instanceId === -1) return 0;
|
||||||
let pedalBoardItem = this.model.pedalBoard.get()?.getItem(instanceId);
|
let pedalBoardItem = this.model.pedalBoard.get()?.getItem(instanceId);
|
||||||
let value: number = pedalBoardItem?.getControlValue(this.props.controlInfo.uiControl.symbol) ?? 0;
|
let value: number = pedalBoardItem?.getControlValue(uiControl.symbol) ?? 0;
|
||||||
this.defaultValue = value;
|
this.defaultValue = value;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ const ZoomedDial = withStyles(styles, { withTheme: true })(
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<img ref={this.imgRef} src="img/fx_dial.svg"
|
<img ref={this.imgRef} src="img/fx_dial.svg" alt=""
|
||||||
style={{
|
style={{
|
||||||
overscrollBehavior: "none", touchAction: "none",
|
overscrollBehavior: "none", touchAction: "none",
|
||||||
width: this.props.size, height: this.props.size, opacity: DEFAULT_OPACITY,
|
width: this.props.size, height: this.props.size, opacity: DEFAULT_OPACITY,
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import React, {SyntheticEvent} from 'react';
|
|||||||
import { Theme, withStyles, WithStyles,createStyles } from '@material-ui/core/styles';
|
import { Theme, withStyles, WithStyles,createStyles } from '@material-ui/core/styles';
|
||||||
import { ZoomedControlInfo } from './PiPedalModel';
|
import { ZoomedControlInfo } from './PiPedalModel';
|
||||||
import DialogEx from './DialogEx';
|
import DialogEx from './DialogEx';
|
||||||
import { TransitionProps } from '@material-ui/core/transitions/transition';
|
|
||||||
import Slide from '@material-ui/core/Slide';
|
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import { PiPedalModelFactory,PiPedalModel } from './PiPedalModel';
|
import { PiPedalModelFactory,PiPedalModel } from './PiPedalModel';
|
||||||
import ZoomedDial from './ZoomedDial';
|
import ZoomedDial from './ZoomedDial';
|
||||||
@@ -43,12 +41,14 @@ interface ZoomedUiControlState {
|
|||||||
value: number
|
value: number
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
const Transition = React.forwardRef(function Transition(
|
const Transition = React.forwardRef(function Transition(
|
||||||
props: TransitionProps & { children?: React.ReactElement },
|
props: TransitionProps & { children?: React.ReactElement },
|
||||||
ref: React.Ref<unknown>,
|
ref: React.Ref<unknown>,
|
||||||
) {
|
) {
|
||||||
return <Slide direction="up" ref={ref} {...props} />;
|
return <Slide direction="up" ref={ref} {...props} />;
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
const ZoomedUiControl = withStyles(styles, { withTheme: true })(
|
const ZoomedUiControl = withStyles(styles, { withTheme: true })(
|
||||||
|
|||||||
@@ -67,6 +67,50 @@ namespace pipedal
|
|||||||
std::string GetJackErrorMessage(jack_status_t status);
|
std::string GetJackErrorMessage(jack_status_t status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GetCpuFrequency(uint64_t*freqMin,uint64_t*freqMax)
|
||||||
|
{
|
||||||
|
uint64_t fMax = 0;
|
||||||
|
uint64_t fMin = UINT64_MAX;
|
||||||
|
char deviceName[128];
|
||||||
|
try {
|
||||||
|
for (int i = 0; true; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
snprintf(deviceName,sizeof(deviceName),"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq",i);
|
||||||
|
std::ifstream f(deviceName);
|
||||||
|
if (!f)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
uint64_t freq;
|
||||||
|
f >> freq;
|
||||||
|
if (!f) break;
|
||||||
|
if (freq < fMin) fMin = freq;
|
||||||
|
if (freq > fMax) fMax = freq;
|
||||||
|
}
|
||||||
|
} catch (const std::exception &)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (fMin == 0) fMax = 0;
|
||||||
|
*freqMin = fMin;
|
||||||
|
*freqMax = fMax;
|
||||||
|
}
|
||||||
|
static std::string GetGovernor()
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
try {
|
||||||
|
std::ifstream f("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
|
||||||
|
f >> result;
|
||||||
|
} catch (const std::exception &)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class JackHostImpl : public JackHost
|
class JackHostImpl : public JackHost
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -1404,6 +1448,9 @@ public:
|
|||||||
{
|
{
|
||||||
result.cpuUsage_ = 0;
|
result.cpuUsage_ = 0;
|
||||||
}
|
}
|
||||||
|
GetCpuFrequency(&result.cpuFreqMax_,&result.cpuFreqMin_);
|
||||||
|
result.governor_ = GetGovernor();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
volatile bool listenForMidiEvent;
|
volatile bool listenForMidiEvent;
|
||||||
@@ -1428,4 +1475,7 @@ JSON_MAP_REFERENCE(JackHostStatus, underruns)
|
|||||||
JSON_MAP_REFERENCE(JackHostStatus, cpuUsage)
|
JSON_MAP_REFERENCE(JackHostStatus, cpuUsage)
|
||||||
JSON_MAP_REFERENCE(JackHostStatus, msSinceLastUnderrun)
|
JSON_MAP_REFERENCE(JackHostStatus, msSinceLastUnderrun)
|
||||||
JSON_MAP_REFERENCE(JackHostStatus, temperaturemC)
|
JSON_MAP_REFERENCE(JackHostStatus, temperaturemC)
|
||||||
|
JSON_MAP_REFERENCE(JackHostStatus, cpuFreqMin)
|
||||||
|
JSON_MAP_REFERENCE(JackHostStatus, cpuFreqMax)
|
||||||
|
JSON_MAP_REFERENCE(JackHostStatus, governor)
|
||||||
JSON_MAP_END()
|
JSON_MAP_END()
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ public:
|
|||||||
float cpuUsage_ = 0;
|
float cpuUsage_ = 0;
|
||||||
uint64_t msSinceLastUnderrun_ = 0;
|
uint64_t msSinceLastUnderrun_ = 0;
|
||||||
int32_t temperaturemC_ = -100000;
|
int32_t temperaturemC_ = -100000;
|
||||||
|
uint64_t cpuFreqMax_ = 0;
|
||||||
|
uint64_t cpuFreqMin_ = 0;
|
||||||
|
std::string governor_;
|
||||||
|
|
||||||
DECLARE_JSON_MAP(JackHostStatus);
|
DECLARE_JSON_MAP(JackHostStatus);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user