-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0e29013
Showing
12 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rpmui | ||
rpmui-linux* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 moson-mo | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# rpmui | ||
## Renoir power metrics UI | ||
</br> | ||
|
||
A simple UI app showing some Renoir power metrics.</br> | ||
It consists of </br> | ||
- A small executable making use of WebKit in order to render HTML</br> | ||
- The HTML/JS frontend which fetches and displays power metrics via [Chart.js]("https://www.chartjs.org/"). | ||
|
||
The HTML page (main.html) can also be opened directly in your browser instead. | ||
|
||
![rpmui](https://github.com/moson-mo/rpmui/raw/master/screenshots/rpmui.png?inline=true) | ||
</br> | ||
|
||
## How to install | ||
|
||
#### Manual | ||
|
||
Binaries are available from the [releases](https://github.com/moson-mo/rpmui/releases) page.</br> | ||
|
||
## How to build | ||
|
||
* Install go from your package manager or download it from the [Golang](https://golang.org/dl/) site. | ||
* Clone repo with `git clone https://github.com/moson-mo/rpmui.git` | ||
* Change to rpmui dir: `cd rpmui` | ||
* Build with `go build` | ||
</br> | ||
|
||
## How to customize | ||
|
||
In the default configuration, the graphs have been made for an 8-core AMD Renoir model.</br> | ||
You can customize *main.html* to your own needs... | ||
</br> | ||
|
||
## Dependencies / Prerequisites | ||
|
||
* [rpms](https://gitlab.com/moson-mo/rpms/) - Renoir power metrics server | ||
</br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/kardianos/osext" | ||
"github.com/webview/webview" | ||
) | ||
|
||
func main() { | ||
path, err := osext.ExecutableFolder() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
w := webview.New(false) | ||
defer w.Destroy() | ||
w.SetTitle("Renoir Power Metrics") | ||
w.SetSize(800, 600, webview.HintNone) | ||
w.Navigate("file://" + path + "/web/main.html") | ||
w.Run() | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<script src="js/jquery-3.5.1.min.js"></script> | ||
<script src="js/Chart.min.js"></script> | ||
<script src="js/chart.js"></script> | ||
<link rel="stylesheet" href="css/chart.css" /> | ||
</head> | ||
|
||
<body> | ||
<div id="container"> | ||
<canvas id="chart"></canvas> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
body { | ||
font-family: monospace; | ||
} | ||
|
||
#container { | ||
position: absolute; | ||
margin: auto; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
height: 95%; | ||
width: 95%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
body { | ||
font-family: monospace; | ||
} | ||
|
||
#container { | ||
position: absolute; | ||
margin: auto; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
iframe { | ||
border: 0px; | ||
} | ||
|
||
.chart { | ||
height: 100%; | ||
width: 50%; | ||
float: left; | ||
} | ||
|
||
.sub-container { | ||
width: 100%; | ||
height: 50%; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
function getUrlVars() { | ||
var vars = {}; | ||
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { | ||
vars[key] = decodeURIComponent(value); | ||
}); | ||
return vars; | ||
} | ||
|
||
function getRandomColor() { | ||
var letters = '0123456789ABCDEF'.split(''); | ||
var color = '#'; | ||
for (var i = 0; i < 6; i++) { | ||
color += letters[Math.floor(Math.random() * 16)]; | ||
} | ||
return color; | ||
} | ||
|
||
$(document).ready(function () { | ||
var dat = [[]]; | ||
var colors = ["#E74C3C", "#3498DB", "#2ECC71", "#F39C12", "#2C3E50"] | ||
|
||
var vars = getUrlVars(); | ||
|
||
if (vars["metrics"] === undefined || vars["metrics"][0] === "undefined") { | ||
$("#container").html("Please specify the metrics for the chart by adding a query parameter \"metrics\".</br>Multiple metrics can be separated by comma.</br></br>Example: ?metrics=SOCKET POWER,PPT FAST LIMIT,PPT SLOW LIMIT") | ||
return; | ||
} | ||
|
||
var metrics = vars["metrics"].split(','); | ||
var title = vars["title"] | ||
|
||
var chart = new Chart($("#chart"), { | ||
type: 'line', | ||
options: { | ||
animation: { | ||
duration: 0, | ||
}, | ||
responsive: true, | ||
maintainAspectRatio: false, | ||
title: { | ||
text: title, | ||
display: true, | ||
}, | ||
scales: { | ||
yAxes: [{ | ||
ticks: { | ||
min: 0, | ||
}, | ||
}] | ||
}, | ||
} | ||
}); | ||
|
||
for (var x = 0; x < metrics.length; x++) { | ||
dat[x] = []; | ||
var col = ""; | ||
if (x > colors.length) { | ||
col = getRandomColor(); | ||
} else { | ||
col = colors[x]; | ||
} | ||
chart.data.datasets.push( | ||
{ | ||
label: metrics[x], | ||
fill: false, | ||
data: dat[x], | ||
borderColor: col | ||
} | ||
); | ||
} | ||
|
||
var i = 1; | ||
window.setInterval(function () { | ||
$.ajax({ | ||
url: "http://127.0.0.1:8090/pmtab" | ||
, | ||
success: function (result) { | ||
for (var x = 0; x < metrics.length; x++) { | ||
dat[x].push(result[metrics[x]].Value); | ||
} | ||
chart.data.labels.push(""); | ||
if (dat[0].length > 30) { | ||
dat.forEach(function (el) { | ||
el.shift(); | ||
}); | ||
chart.data.labels.shift(); | ||
} | ||
chart.update(); | ||
i++; | ||
} | ||
}); | ||
}, 1000); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<link rel="stylesheet" href="css/main.css" /> | ||
</head> | ||
|
||
<body> | ||
<div id="container"> | ||
<div class="sub-container"> | ||
<iframe class="chart" | ||
src="chart.html?title=CPU Power (W)&metrics=SOCKET POWER,STAPM LIMIT,PPT LIMIT FAST,PPT LIMIT SLOW"></iframe> | ||
<iframe class="chart" | ||
src="chart.html?title=CPU frequency (GHz)&metrics=CORE FREQ 0,CORE FREQ 1,CORE FREQ 2,CORE FREQ 3,CORE FREQ 4,CORE FREQ 5,CORE FREQ 6,CORE FREQ 7"></iframe> | ||
</div> | ||
<div class="sub-container"> | ||
<iframe class="chart" | ||
src="chart.html?title=Temperatures (°C)&metrics=THM VALUE GFX,THM VALUE CORE,THM LIMIT CORE"></iframe> | ||
<iframe class="chart" src="chart.html?title=GPU Frequency (MHz)&metrics=GFX FREQ,MEMCLK FREQ"></iframe> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |