Skip to content

Commit 9b644fd

Browse files
committed
[CLI] UI_RULER_MINIMUM & UI_RULER_MAXIMUM building constraints
1 parent 332dbda commit 9b644fd

File tree

3 files changed

+68
-12
lines changed

3 files changed

+68
-12
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ ifneq ($(UI_TRANSPARENCY),)
9797
LAYOUT += -D UI_TRANSPARENCY=$(UI_TRANSPARENCY)
9898
endif
9999

100+
ifneq ($(UI_RULER_MINIMUM),)
101+
LAYOUT += -D UI_RULER_MINIMUM=$(UI_RULER_MINIMUM)
102+
endif
103+
104+
ifneq ($(UI_RULER_MAXIMUM),)
105+
LAYOUT += -D UI_RULER_MAXIMUM=$(UI_RULER_MAXIMUM)
106+
endif
107+
100108
.PHONY: all
101109
all: prepare corefreqd corefreq-cli | prepare
102110
@if [ -e $(BUILD)/Makefile ]; then \
@@ -332,6 +340,8 @@ help:
332340
"| when <F> is 1: don't build and display this area part |\n"\
333341
"| UI_TRANSPARENCY=<F> |\n"\
334342
"| when <F> is 1: build with background transparency |\n"\
343+
"| UI_RULER_MINIMUM=<N>, UI_RULER_MAXIMUM=<N> |\n"\
344+
"| set ruler left or right bound to <N> frequency ratio |\n"\
335345
"| |\n"\
336346
"| Example: |\n"\
337347
"| make CC=gcc OPTIM_LVL=3 FEAT_DBG=1 ARCH_PMC=PCU |\n"\

aarch64/corefreq-cli.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,33 @@ void AggregateRatio(void)
216216
}
217217
InsertionSortRuler(Ruler.Uniq, Ruler.Count, BOOST(MIN));
218218

219+
#ifndef UI_RULER_MINIMUM
219220
Ruler.Minimum = (double) lowest;
221+
#elif (UI_RULER_MINIMUM > 0) && (UI_RULER_MINIMUM <= MAX_WIDTH)
222+
Ruler.Minimum = (double) UI_RULER_MINIMUM;
223+
#else
224+
Ruler.Minimum = 1.0;
225+
#endif
226+
#ifndef UI_RULER_MAXIMUM
220227
Ruler.Maximum = (double) highest;
221-
Ruler.Median = (double) RO(Shm)->Cpu[
222-
Ruler.Top[BOOST(ACT)]
223-
].Boost[BOOST(ACT)];
228+
#elif (UI_RULER_MAXIMUM > 0) && (UI_RULER_MAXIMUM <= MAX_WIDTH)
229+
Ruler.Maximum = (double) UI_RULER_MAXIMUM;
230+
#else
231+
Ruler.Maximum = (double) MIN_WIDTH;
232+
#endif
233+
#if !defined(UI_RULER_MINIMUM) && !defined(UI_RULER_MAXIMUM)
234+
{
235+
const double median = (double) RO(Shm)->Cpu[
236+
Ruler.Top[BOOST(ACT)]
237+
].Boost[BOOST(ACT)];
224238

239+
if ((median > Ruler.Minimum) && (median < Ruler.Maximum)) {
240+
Ruler.Median = median;
241+
}
242+
}
243+
#else
244+
Ruler.Median = 0.0;
245+
#endif
225246
if (Ruler.Median == 0.0) {
226247
Ruler.Median = (Ruler.Minimum + Ruler.Maximum) / 2.0;
227248
}
@@ -13143,8 +13164,10 @@ void Layout_Ruler_Load(Layer *layer, CUINT row)
1314313164

1314413165
/* Alternate the color of the frequency ratios */
1314513166
while (idx--)
13146-
{
13147-
double fPos = (Ruler.Uniq[idx] * Draw.Area.LoadWidth) / Ruler.Maximum;
13167+
if (Ruler.Uniq[idx] <= Ruler.Maximum)
13168+
{
13169+
const double fPos = (Ruler.Uniq[idx] * Draw.Area.LoadWidth)
13170+
/ Ruler.Maximum;
1314813171
CUINT hPos = (CUINT) fPos;
1314913172

1315013173
ASCII tabStop[10+1] = "00";
@@ -13161,7 +13184,7 @@ void Layout_Ruler_Load(Layer *layer, CUINT row)
1316113184
bright = !bright;
1316213185
}
1316313186
lPos = hPos >= margin ? hPos - margin : margin;
13164-
}
13187+
}
1316513188
LayerCopyAt(layer, hLoad1.origin.col, hLoad1.origin.row, hLoad1.length,
1316613189
hLoad1.attr[Draw.Load], hLoad1.code[Draw.Load]);
1316713190
}

x86_64/corefreq-cli.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,33 @@ void AggregateRatio(void)
216216
}
217217
InsertionSortRuler(Ruler.Uniq, Ruler.Count, BOOST(MIN));
218218

219+
#ifndef UI_RULER_MINIMUM
219220
Ruler.Minimum = (double) lowest;
221+
#elif (UI_RULER_MINIMUM > 0) && (UI_RULER_MINIMUM <= MAX_WIDTH)
222+
Ruler.Minimum = (double) UI_RULER_MINIMUM;
223+
#else
224+
Ruler.Minimum = 1.0;
225+
#endif
226+
#ifndef UI_RULER_MAXIMUM
220227
Ruler.Maximum = (double) highest;
221-
Ruler.Median = (double) RO(Shm)->Cpu[
222-
Ruler.Top[BOOST(ACT)]
223-
].Boost[BOOST(ACT)];
228+
#elif (UI_RULER_MAXIMUM > 0) && (UI_RULER_MAXIMUM <= MAX_WIDTH)
229+
Ruler.Maximum = (double) UI_RULER_MAXIMUM;
230+
#else
231+
Ruler.Maximum = (double) MIN_WIDTH;
232+
#endif
233+
#if !defined(UI_RULER_MINIMUM) && !defined(UI_RULER_MAXIMUM)
234+
{
235+
const double median = (double) RO(Shm)->Cpu[
236+
Ruler.Top[BOOST(ACT)]
237+
].Boost[BOOST(ACT)];
224238

239+
if ((median > Ruler.Minimum) && (median < Ruler.Maximum)) {
240+
Ruler.Median = median;
241+
}
242+
}
243+
#else
244+
Ruler.Median = 0.0;
245+
#endif
225246
if (Ruler.Median == 0.0) {
226247
Ruler.Median = (Ruler.Minimum + Ruler.Maximum) / 2.0;
227248
}
@@ -17738,8 +17759,10 @@ void Layout_Ruler_Load(Layer *layer, CUINT row)
1773817759

1773917760
/* Alternate the color of the frequency ratios */
1774017761
while (idx--)
17741-
{
17742-
double fPos = (Ruler.Uniq[idx] * Draw.Area.LoadWidth) / Ruler.Maximum;
17762+
if (Ruler.Uniq[idx] <= Ruler.Maximum)
17763+
{
17764+
const double fPos = (Ruler.Uniq[idx] * Draw.Area.LoadWidth)
17765+
/ Ruler.Maximum;
1774317766
CUINT hPos = (CUINT) fPos;
1774417767

1774517768
ASCII tabStop[10+1] = "00";
@@ -17756,7 +17779,7 @@ void Layout_Ruler_Load(Layer *layer, CUINT row)
1775617779
bright = !bright;
1775717780
}
1775817781
lPos = hPos >= margin ? hPos - margin : margin;
17759-
}
17782+
}
1776017783
LayerCopyAt(layer, hLoad1.origin.col, hLoad1.origin.row, hLoad1.length,
1776117784
hLoad1.attr[Draw.Load], hLoad1.code[Draw.Load]);
1776217785
}

0 commit comments

Comments
 (0)