Skip to content

Commit f463ef7

Browse files
authored
Merge pull request #36 from context-labs/development
Small fixes
2 parents 830daca + 6b77077 commit f463ef7

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

main.go

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,10 @@ func setupGrid() {
180180
grid = ui.NewGrid()
181181
grid.Set(
182182
ui.NewRow(1.0/2, // This row now takes half the height of the grid
183-
ui.NewCol(1.0/2, ui.NewRow(1.0/2, cpu1Gauge), ui.NewCol(1.0, ui.NewRow(1.0, cpu2Gauge))),
184-
ui.NewCol(1.0/2, ui.NewRow(1.0/2, gpuGauge), ui.NewCol(1.0, ui.NewRow(1.0, processList))), // ui.NewCol(1.0/2, ui.NewRow(1.0, ProcessInfo)), // ProcessInfo spans this entire column
183+
ui.NewCol(1.0/2, ui.NewRow(1.0/2, cpu1Gauge), ui.NewCol(1.0, ui.NewRow(1.0, cpu2Gauge))), ui.NewCol(1.0/2, ui.NewRow(1.0/2, gpuGauge), ui.NewCol(1.0, ui.NewRow(1.0, processList))), // ui.NewCol(1.0/2, ui.NewRow(1.0, ProcessInfo)), // ProcessInfo spans this entire column
185184
),
186185
ui.NewRow(1.0/4,
187-
ui.NewCol(1.0/6, modelText),
188-
ui.NewCol(1.0/3, NetworkInfo),
189-
ui.NewCol(1.0/4, PowerChart),
190-
ui.NewCol(1.0/4, TotalPowerChart),
186+
ui.NewCol(1.0/6, modelText), ui.NewCol(1.0/3, NetworkInfo), ui.NewCol(1.0/4, PowerChart), ui.NewCol(1.0/4, TotalPowerChart),
191187
),
192188
ui.NewRow(1.0/4,
193189
ui.NewCol(1.0, memoryGauge),
@@ -200,8 +196,7 @@ func switchGridLayout() {
200196
newGrid := ui.NewGrid()
201197
newGrid.Set(
202198
ui.NewRow(1.0/4,
203-
ui.NewCol(1.0/2, ui.NewRow(1.0, cpu1Gauge)),
204-
ui.NewCol(1.0/2, ui.NewRow(1.0, cpu2Gauge)),
199+
ui.NewCol(1.0/2, ui.NewRow(1.0, cpu1Gauge)), ui.NewCol(1.0/2, ui.NewRow(1.0, cpu2Gauge)),
205200
),
206201
ui.NewRow(2.0/4,
207202
ui.NewCol(1.0/2,
@@ -214,9 +209,7 @@ func switchGridLayout() {
214209
ui.NewCol(1.0/2, processList),
215210
),
216211
ui.NewRow(1.0/4,
217-
ui.NewCol(3.0/6, memoryGauge),
218-
ui.NewCol(1.0/6, modelText),
219-
ui.NewCol(2.0/6, NetworkInfo),
212+
ui.NewCol(3.0/6, memoryGauge), ui.NewCol(1.0/6, modelText), ui.NewCol(2.0/6, NetworkInfo),
220213
),
221214
)
222215
termWidth, termHeight := ui.TerminalDimensions()
@@ -227,14 +220,10 @@ func switchGridLayout() {
227220
newGrid := ui.NewGrid()
228221
newGrid.Set(
229222
ui.NewRow(1.0/2,
230-
ui.NewCol(1.0/2, ui.NewRow(1.0/2, cpu1Gauge), ui.NewCol(1.0, ui.NewRow(1.0, cpu2Gauge))),
231-
ui.NewCol(1.0/2, ui.NewRow(1.0/2, gpuGauge), ui.NewCol(1.0, ui.NewRow(1.0, processList))),
223+
ui.NewCol(1.0/2, ui.NewRow(1.0/2, cpu1Gauge), ui.NewCol(1.0, ui.NewRow(1.0, cpu2Gauge))), ui.NewCol(1.0/2, ui.NewRow(1.0/2, gpuGauge), ui.NewCol(1.0, ui.NewRow(1.0, processList))),
232224
),
233225
ui.NewRow(1.0/4,
234-
ui.NewCol(1.0/4, modelText),
235-
ui.NewCol(1.0/4, NetworkInfo),
236-
ui.NewCol(1.0/4, PowerChart),
237-
ui.NewCol(1.0/4, TotalPowerChart),
226+
ui.NewCol(1.0/4, modelText), ui.NewCol(1.0/4, NetworkInfo), ui.NewCol(1.0/4, PowerChart), ui.NewCol(1.0/4, TotalPowerChart),
238227
),
239228
ui.NewRow(1.0/4,
240229
ui.NewCol(1.0, memoryGauge),
@@ -277,7 +266,7 @@ func toggleHelpMenu() {
277266
func togglePartyMode() {
278267
partyMode = !partyMode
279268
if partyMode {
280-
partyTicker = time.NewTicker(500 * time.Millisecond)
269+
partyTicker = time.NewTicker(time.Duration(updateInterval/2) * time.Millisecond)
281270
go func() {
282271
for range partyTicker.C {
283272
if !partyMode {
@@ -340,7 +329,7 @@ func main() {
340329
err error
341330
setColor, setInterval bool
342331
)
343-
version := "v0.2.0"
332+
version := "v0.2.1"
344333
for i := 1; i < len(os.Args); i++ {
345334
switch os.Args[i] {
346335
case "--help", "-h":
@@ -436,7 +425,7 @@ func main() {
436425
netdiskMetricsChan := make(chan NetDiskMetrics, 1)
437426
go collectMetrics(done, cpuMetricsChan, gpuMetricsChan, netdiskMetricsChan)
438427
go func() {
439-
ticker := time.NewTicker(time.Duration(updateInterval/2) * time.Millisecond)
428+
ticker := time.NewTicker(time.Duration(updateInterval) * time.Millisecond)
440429
defer ticker.Stop()
441430
for {
442431
select {
@@ -877,6 +866,19 @@ func parseCPUMetrics(powermetricsOutput string, cpuMetrics CPUMetrics) CPUMetric
877866
if combinedPower, ok := processor["combined_power"].(float64); ok {
878867
cpuMetrics.PackageW = float64(combinedPower) / 1000
879868
}
869+
if _, exists := cpuMetricDict["P-Cluster_freq_Mhz"]; !exists {
870+
var totalFreq float64
871+
var clusterCount int
872+
for i := 0; i <= 50; i++ {
873+
if freq, ok := cpuMetricDict[fmt.Sprintf("P-Cluster%d_freq_Mhz", i)].(int); ok {
874+
totalFreq += float64(freq)
875+
clusterCount++
876+
}
877+
}
878+
if clusterCount > 0 {
879+
cpuMetrics.PClusterFreqMHz = int(totalFreq / float64(clusterCount))
880+
}
881+
}
880882
return cpuMetrics
881883
}
882884

0 commit comments

Comments
 (0)