Skip to content

Commit

Permalink
graph view now shows latest value
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasmr committed Feb 13, 2024
1 parent aa8f068 commit 96c9aab
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 23 deletions.
85 changes: 62 additions & 23 deletions microprofile_html.h
Original file line number Diff line number Diff line change
Expand Up @@ -11138,15 +11138,54 @@ const char g_MicroProfileHtmlLive_begin_1[] =
" context.fillStyle = \'wheat\';\n"
" context.textAlign=\'right\';\n"
" context.fillText(FormatTimeText(Reference, T), nWidth, hstart + FontHeight);\n"
" {\n"
" let Value = Time[Time.length-1];\n"
" let YPos = Value * fHeightScale2 + Math.floor(0.5*FontHeight);\n"
" const sp = FontHeight+2;\n"
" YPos = Math.min(Math.max(sp, YPos), gh-2*sp);\n"
" let Y = YStart - YPos;\n"
" TimerState.finaly = Y;\n"
" if(TimerState.finalysoft)\n"
" {\n"
" let RATE = 0.025;\n"
" if(Math.abs(TimerState.finalysoft - TimerState.finaly) > 6)\n"
" {\n"
" TimerState.finalysoft = TimerState.finaly * RATE + TimerState.finalysoft * (1-RATE);\n"
" }\n"
" }\n"
" else\n"
" {\n"
" TimerState.finalysoft = TimerState.finaly;\n"
" }\n"
" Y = TimerState.finalysoft;\n"
" let str = \'\' + FormatTimeText(Value, T);\n"
" let X = nWidth;\n"
" let w = context.measureText(str, X, Y).width;\n"
" context.fillStyle = \'black\';\n"
" let a = context.globalAlpha;\n"
" context.globalAlpha = 0.3;\n"
" context.fillRect(X-w, Y-1-FontHeight , w+2, BoxHeight+2);\n"
" context.globalAlpha = a;\n"
" context.fillStyle = \'white\';\n"
" context.fillText(FormatTimeText(Value, T), nWidth, TimerState.finalysoft);\n"
" \n"
"\n"
" }\n"
" context.textAlign=\'left\';\n"
" context.fillText(FormatName(T), 15, hstart + FontHeight);\n"
"\n"
"\n"
" let Type = CounterType(key);\n"
" if(Type != CurrentType)\n"
" { \n"
" CurrentType = Type;\n"
" DrawGraphViewLargeHeader(context, CounterTypeName(CurrentType), YHeader, FontHeight + 3);\n"
" }\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" if(HighlightFrame >= 0)\n"
" {\n"
" let X = w - Time.length * fWidth + fWidth * HighlightFrame;\n"
Expand Down Expand Up @@ -11511,6 +11550,10 @@ const char g_MicroProfileHtmlLive_begin_1[] =
" NumGraphs = 0;\n"
" for(let index in Keys)\n"
" {\n"
"";

const size_t g_MicroProfileHtmlLive_begin_1_size = sizeof(g_MicroProfileHtmlLive_begin_1);
const char g_MicroProfileHtmlLive_begin_2[] =
" let key = Keys[index];\n"
" {\n"
" let idx = GetTimer(key);\n"
Expand Down Expand Up @@ -11552,11 +11595,7 @@ const char g_MicroProfileHtmlLive_begin_1[] =
" return;\n"
" }\n"
"\n"
" var CaptureRange = MouseDragActiveXStart < MouseDragActiveXEnd ? \"Selection\" : (\"\"+Settings.CaptureFr";

const size_t g_MicroProfileHtmlLive_begin_1_size = sizeof(g_MicroProfileHtmlLive_begin_1);
const char g_MicroProfileHtmlLive_begin_2[] =
"ames);\n"
" var CaptureRange = MouseDragActiveXStart < MouseDragActiveXEnd ? \"Selection\" : (\"\"+Settings.CaptureFrames);\n"
" var CaptureText = \"Capture[\" + CaptureRange + \"]\";\n"
" var w = 10 + context.measureText(CaptureText).width;\n"
" var X = nWidth / 2 - w / 2;\n"
Expand Down Expand Up @@ -12965,7 +13004,11 @@ const char g_MicroProfileHtmlLive_begin_2[] =
" }\n"
"\n"
" {\n"
" let str = T.idtype == TYPE_TIMER ? \"TIMERS\" : (T.format == FormatCounterBytes ? \"BYTE COUNTERS\" : \"COUNTERS\");\n"
" let str = T.idtype == TYPE_TIMER ? \"TIMERS\" : (T.format == FormatCounterBytes ? \"BYTE COUNTERS\" : \"COUNTERS\")";

const size_t g_MicroProfileHtmlLive_begin_2_size = sizeof(g_MicroProfileHtmlLive_begin_2);
const char g_MicroProfileHtmlLive_begin_3[] =
";\n"
" DrawMenuElement(M, 0, \"--- ALL \" + str + \" -- \", \"\", \'white\');\n"
" let Apply = function(Callback){\n"
" let AllSettings = Percentile ? Settings.SubGraphSettingsPercentile : Settings.SubGraphSettings;\n"
Expand Down Expand Up @@ -13002,11 +13045,7 @@ const char g_MicroProfileHtmlLive_begin_2[] =
" }\n"
" }\n"
"\n"
" if(DrawMenuEleme";

const size_t g_MicroProfileHtmlLive_begin_2_size = sizeof(g_MicroProfileHtmlLive_begin_2);
const char g_MicroProfileHtmlLive_begin_3[] =
"nt(M, SubGraphSettings.AutomaticReference, \"Automatic Reference Value\", SubGraphSettings.AutomaticReference, \'white\'))\n"
" if(DrawMenuElement(M, SubGraphSettings.AutomaticReference, \"Automatic Reference Value\", SubGraphSettings.AutomaticReference, \'white\'))\n"
" {\n"
" SubGraphSettings.AutomaticReference = 1-SubGraphSettings.AutomaticReference;\n"
" Apply(function(T){\n"
Expand Down Expand Up @@ -14268,7 +14307,11 @@ const char g_MicroProfileHtmlLive_begin_3[] =
"\n"
"function DrawMenuCounters()\n"
"{\n"
" if(FilterInputValueLast != FilterInput.value)\n"
" if(FilterInputValue";

const size_t g_MicroProfileHtmlLive_begin_3_size = sizeof(g_MicroProfileHtmlLive_begin_3);
const char g_MicroProfileHtmlLive_begin_4[] =
"Last != FilterInput.value)\n"
" {\n"
" nOffsetMenuCounters = 0;\n"
" }\n"
Expand Down Expand Up @@ -14301,11 +14344,7 @@ const char g_MicroProfileHtmlLive_begin_3[] =
" context.fillStyle = color;\n"
" if(!Indent) Indent = 0;\n"
" context.fillText(Name, X + Indent*FontWidth, Y+BoxHeight-FontAscent);\n"
" nColorIndex = 1-nColor";

const size_t g_MicroProfileHtmlLive_begin_3_size = sizeof(g_MicroProfileHtmlLive_begin_3);
const char g_MicroProfileHtmlLive_begin_4[] =
"Index;\n"
" nColorIndex = 1-nColorIndex;\n"
" Y += BoxHeight;\n"
" return bMouseIn;\n"
" }\n"
Expand Down Expand Up @@ -15745,7 +15784,11 @@ const char g_MicroProfileHtmlLive_begin_4[] =
"{\n"
" MouseDragState = MouseDragOff;\n"
" MouseDragTarget = 0;\n"
" MouseDragKeyShift = 0;\n"
" MouseDragKeyShi";

const size_t g_MicroProfileHtmlLive_begin_4_size = sizeof(g_MicroProfileHtmlLive_begin_4);
const char g_MicroProfileHtmlLive_begin_5[] =
"ft = 0;\n"
" MouseDragKeyCtrl = 0;\n"
" MouseDragButton = 0;\n"
"}\n"
Expand Down Expand Up @@ -15790,11 +15833,7 @@ const char g_MicroProfileHtmlLive_begin_4[] =
" if(Source == MouseDragDown || KeyShiftDown || KeyCtrlDown)\n"
" {\n"
" MouseDragTarget = Event.target;\n"
" Mou";

const size_t g_MicroProfileHtmlLive_begin_4_size = sizeof(g_MicroProfileHtmlLive_begin_4);
const char g_MicroProfileHtmlLive_begin_5[] =
"seDragButton = MapMouseButton(Event);\n"
" MouseDragButton = MapMouseButton(Event);\n"
" MouseDragState = MouseDragDown;\n"
" MouseDragXStart = MouseDragX;\n"
" MouseDragYStart = MouseDragY;\n"
Expand Down
35 changes: 35 additions & 0 deletions src/microprofilelive.html
Original file line number Diff line number Diff line change
Expand Up @@ -2294,8 +2294,43 @@
context.fillStyle = 'wheat';
context.textAlign='right';
context.fillText(FormatTimeText(Reference, T), nWidth, hstart + FontHeight);
{
let Value = Time[Time.length-1];
let YPos = Value * fHeightScale2 + Math.floor(0.5*FontHeight);
const sp = FontHeight+2;
YPos = Math.min(Math.max(sp, YPos), gh-2*sp);
let Y = YStart - YPos;
TimerState.finaly = Y;
if(TimerState.finalysoft)
{
let RATE = 0.025;
if(Math.abs(TimerState.finalysoft - TimerState.finaly) > 6)
{
TimerState.finalysoft = TimerState.finaly * RATE + TimerState.finalysoft * (1-RATE);
}
}
else
{
TimerState.finalysoft = TimerState.finaly;
}
Y = TimerState.finalysoft;
let str = '' + FormatTimeText(Value, T);
let X = nWidth;
let w = context.measureText(str, X, Y).width;
context.fillStyle = 'black';
let a = context.globalAlpha;
context.globalAlpha = 0.3;
context.fillRect(X-w, Y-1-FontHeight , w+2, BoxHeight+2);
context.globalAlpha = a;
context.fillStyle = 'white';
context.fillText(FormatTimeText(Value, T), nWidth, TimerState.finalysoft);


}
context.textAlign='left';
context.fillText(FormatName(T), 15, hstart + FontHeight);


let Type = CounterType(key);
if(Type != CurrentType)
{
Expand Down

0 comments on commit 96c9aab

Please sign in to comment.