Skip to content

Commit

Permalink
[UI] Layout of the Custom view.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyring committed Jul 11, 2021
1 parent eb53b87 commit 5adce7f
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 27 deletions.
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ ifneq ($(UI_TRANSPARENCY),)
LAYOUT += -D UI_TRANSPARENCY=$(UI_TRANSPARENCY)
endif

ifneq ($(CUSTOM_RULER),)
LAYOUT += -D CUSTOM_RULER='"$(CUSTOM_RULER)"'
endif

ifneq ($(CUSTOM_FIELD),)
LAYOUT += -D CUSTOM_FIELD='"$(CUSTOM_FIELD)"'
endif

.PHONY: all
all: corefreqd corefreq-cli
$(MAKE) -j1 -C $(KERNELDIR) M=$(PWD) modules
Expand Down Expand Up @@ -225,10 +217,6 @@ help:
"| UI_TRANSPARENCY=<F> |\n"\
"| when <F> is 1: build with background transparency |\n"\
"| |\n"\
"| Custom view ( printf syntax ): |\n"\
"| CUSTOM_RULER='string' |\n"\
"| CUSTOM_FIELD='format' |\n"\
"| |\n"\
"| Example: |\n"\
"| make CC=gcc OPTIM_LVL=3 FEAT_DBG=1 |\n"\
"| MSR_CORE_PERF_UCC=MSR_CORE_PERF_FIXED_CTR1 |\n"\
Expand Down
26 changes: 25 additions & 1 deletion corefreq-cli-rsc-en.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' \
}

#define RSC_LAYOUT_CUSTOM_FIELD_CODE_EN \
{ \
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',\
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' \
}

#define RSC_LAYOUT_RULER_FREQUENCY_CODE_EN \
{ \
'-','-','-',' ','F','r','e','q','(','M','H','z',')',' ','R','a',\
Expand Down Expand Up @@ -524,7 +548,7 @@

#define RSC_LAYOUT_RULER_CUSTOM_CODE_EN \
"----- Min - Relative - Max ---- Min - Absolute - Max - Min T" \
"MP Max - Min(V) - Vcore - Max(V) - Min ---- Power -- Max ---" \
"MP Max - Min(V) - Vcore - Max(V) - Min( ) - Power -- Max( ) " \
"- Turbo - C0 --- C1 -- C2:C3 - C4:C6 - C7 --- IPS ----- IPC " \
"----- CPI --------------------------------------------------" \
"------------------------------------------------------------" \
Expand Down
2 changes: 2 additions & 0 deletions corefreq-cli-rsc-fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ do echo -en "$h$l\t""\xc3""\x$h$l""\t"; done; done;echo

#define RSC_LAYOUT_MONITOR_SLICE_CODE_FR RSC_LAYOUT_MONITOR_SLICE_CODE_EN

#define RSC_LAYOUT_CUSTOM_FIELD_CODE_FR RSC_LAYOUT_CUSTOM_FIELD_CODE_EN

#define RSC_LAYOUT_RULER_FREQUENCY_CODE_FR \
{ \
'-','-','-',' ','F','r',0xa9,'q','(','M','H','z',')',' ','R','a',\
Expand Down
36 changes: 36 additions & 0 deletions corefreq-cli-rsc-theme-dflt.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,42 @@
HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK \
}

#define RSC_LAYOUT_CUSTOM_FIELD_THM_DFLT_ATTR \
{ \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,HWK,HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,HWK,HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,HWK,HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,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\
Expand Down
36 changes: 36 additions & 0 deletions corefreq-cli-rsc-theme-usr1.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,42 @@
HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW,HRW \
}

#define RSC_LAYOUT_CUSTOM_FIELD_THM_USR1_ATTR \
{ \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW, \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW, \
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,\
HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW,HKW \
}

#define RSC_LAYOUT_RULER_FREQUENCY_THM_USR1_ATTR \
{ \
LKW,LKW,LKW,LKW,LKW,LKW,LKW,LKW,HKW,LKW,LKW,LKW,HKW,LKW,LKW,LKW,\
Expand Down
36 changes: 36 additions & 0 deletions corefreq-cli-rsc-theme-usr2.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,42 @@
HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK,HRK \
}

#define RSC_LAYOUT_CUSTOM_FIELD_THM_USR2_ATTR \
{ \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,HWK,HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
HWK,HWK,HWK,HWK,HWK,HWK,HWK,LWK, \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK, \
LWK,LWK,LWK,L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WK,LWK,LWK,LWK,\
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK \
}

#define RSC_LAYOUT_RULER_FREQUENCY_THM_USR2_ATTR \
{ \
LWK,LWK,LWK,LWK,LWK,LWK,LWK,LWK,HDK,LWK,LWK,LWK,HDK,LWK,LWK,LWK,\
Expand Down
2 changes: 2 additions & 0 deletions corefreq-cli-rsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ DEF_LDA(RSC_LAYOUT_MONITOR_INST);
DEF_LDA(RSC_LAYOUT_MONITOR_COMMON);
DEF_LDA(RSC_LAYOUT_MONITOR_TASKS);
DEF_LDA(RSC_LAYOUT_MONITOR_SLICE);
DEF_LDA(RSC_LAYOUT_CUSTOM_FIELD);
DEF_LDA(RSC_LAYOUT_RULER_FREQUENCY);
DEF_LDA(RSC_LAYOUT_RULER_FREQUENCY_AVG);
DEF_LDA(RSC_LAYOUT_RULER_FREQUENCY_PKG);
Expand Down Expand Up @@ -341,6 +342,7 @@ RESOURCE_ST Resource[] = {
LDA(RSC_LAYOUT_MONITOR_COMMON),
LDA(RSC_LAYOUT_MONITOR_TASKS),
LDA(RSC_LAYOUT_MONITOR_SLICE),
LDA(RSC_LAYOUT_CUSTOM_FIELD),
LDA(RSC_LAYOUT_RULER_FREQUENCY),
LDA(RSC_LAYOUT_RULER_FREQUENCY_AVG),
LDA(RSC_LAYOUT_RULER_FREQUENCY_PKG),
Expand Down
1 change: 1 addition & 0 deletions corefreq-cli-rsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ enum {
RSC_LAYOUT_MONITOR_COMMON,
RSC_LAYOUT_MONITOR_TASKS,
RSC_LAYOUT_MONITOR_SLICE,
RSC_LAYOUT_CUSTOM_FIELD,
RSC_LAYOUT_RULER_FREQUENCY,
RSC_LAYOUT_RULER_FREQUENCY_AVG,
RSC_LAYOUT_RULER_FREQUENCY_PKG,
Expand Down
26 changes: 12 additions & 14 deletions corefreq-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -13554,8 +13554,11 @@ CUINT Layout_Monitor_Slice(Layer *layer, const unsigned int cpu, CUINT row)

CUINT Layout_Monitor_Custom(Layer *layer, const unsigned int cpu, CUINT row)
{
LayerFillAt( layer, (LOAD_LEAD - 1), row,
Draw.Size.width, hSpace, MakeAttr(WHITE, 0, BLACK, 1) );
LayerDeclare( LAYOUT_CUSTOM_FIELD, RSZ(LAYOUT_CUSTOM_FIELD),
(LOAD_LEAD - 1), row, hCustom0 );

LayerCopyAt( layer, hCustom0.origin.col, hCustom0.origin.row,
hCustom0.length, hCustom0.attr, hCustom0.code );
UNUSED(cpu);

return (0);
Expand Down Expand Up @@ -14012,20 +14015,20 @@ CUINT Layout_Ruler_Slice(Layer *layer, const unsigned int cpu, CUINT row)

CUINT Layout_Ruler_Custom(Layer *layer, const unsigned int cpu, CUINT row)
{
#ifndef CUSTOM_RULER
LayerDeclare(LAYOUT_RULER_CUSTOM, Draw.Size.width, 0, row, hCust0);

UNUSED(cpu);

LayerCopyAt( layer, hCust0.origin.col, hCust0.origin.row,
hCust0.length, hCust0.attr, hCust0.code );
#else
LayerFillAt( layer, 0, row,
__builtin_strlen(CUSTOM_RULER), CUSTOM_RULER,
RSC(UI).ATTR()[UI_LAYOUT_RULER_CUSTOM] );
#endif /* CUSTOM_RULER */

LayerFillAt( layer, 0, (row + Draw.Area.MaxRows + 1),
Draw.Size.width, hLine,
RSC(UI).ATTR()[UI_LAYOUT_RULER_CUSTOM] );
UNUSED(cpu);

LayerAt(layer, code, 99, hCust0.origin.row) = \
LayerAt(layer, code, 117, hCust0.origin.row) = \
Setting.jouleWatt ? 'W':'J';

row += Draw.Area.MaxRows + 2;
return (row);
Expand Down Expand Up @@ -15792,7 +15795,6 @@ CUINT Draw_Monitor_Custom(Layer *layer, const unsigned int cpu, CUINT row)
struct FLIP_FLOP *CFlop = &Cpu->FlipFlop[!Shm->Cpu[cpu].Toggle];

size_t len;
#ifndef CUSTOM_FIELD
len = snprintf(Buffer, MAX_WIDTH,
"%7.2f %7.2f %7.2f" \
"\x20\x20\x20" "%7.2f %7.2f %7.2f" \
Expand All @@ -15801,10 +15803,6 @@ CUINT Draw_Monitor_Custom(Layer *layer, const unsigned int cpu, CUINT row)
"\x20\x20" "%8.4f %8.4f %8.4f" \
"\x20\x20" "%6.2f %6.2f %6.2f %6.2f %6.2f %6.2f" \
"\x20\x20" "%10.6f" "%10.6f" "%10.6f",
#else
len = snprintf(Buffer, MAX_WIDTH, CUSTOM_FIELD,
#endif /* CUSTOM_FIELD */

/* [ 1] MIN_REL_FREQ */
Cpu->Relative.Freq[SENSOR_LOWEST],
/* [ 2] RELATIVE_FREQ */
Expand Down

0 comments on commit 5adce7f

Please sign in to comment.