mirror of https://gitlab.com/basile.b/dexed.git
profile viewer, add column w/ slices color
This commit is contained in:
parent
d1dcefda18
commit
0342a728d4
|
@ -24,6 +24,12 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
Columns = <
|
Columns = <
|
||||||
|
item
|
||||||
|
AutoSize = True
|
||||||
|
MaxWidth = 18
|
||||||
|
MinWidth = 18
|
||||||
|
Width = 18
|
||||||
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Num calls'
|
Caption = 'Num calls'
|
||||||
|
@ -32,25 +38,26 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Tree time'
|
Caption = 'Tree time'
|
||||||
Width = 67
|
|
||||||
end
|
|
||||||
item
|
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Func time'
|
|
||||||
Width = 72
|
Width = 72
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Per call'
|
Caption = 'Func time'
|
||||||
Width = 55
|
Width = 55
|
||||||
end
|
end
|
||||||
|
item
|
||||||
|
AutoSize = True
|
||||||
|
Caption = 'Per call'
|
||||||
|
Width = 62
|
||||||
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'function'
|
Caption = 'function'
|
||||||
Width = 274
|
Width = 261
|
||||||
end>
|
end>
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ScrollBars = ssAutoBoth
|
ScrollBars = ssAutoBoth
|
||||||
|
SmallImages = ImageList1
|
||||||
SortType = stText
|
SortType = stText
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
ViewStyle = vsReport
|
ViewStyle = vsReport
|
||||||
|
@ -90,7 +97,8 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
Title.Text.Strings = (
|
Title.Text.Strings = (
|
||||||
'TAChart'
|
'TAChart'
|
||||||
)
|
)
|
||||||
Toolset = pieTools
|
Toolset = ChartToolset1
|
||||||
|
OnDrawLegend = pieDrawLegend
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderSpacing.Around = 2
|
BorderSpacing.Around = 2
|
||||||
object pieSeries: TPieSeries
|
object pieSeries: TPieSeries
|
||||||
|
@ -100,7 +108,7 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
Marks.Shape = clsRoundRect
|
Marks.Shape = clsRoundRect
|
||||||
Marks.Format = '%2:s %1:.2f%%'
|
Marks.Format = '%2:s %1:.2f%%'
|
||||||
Marks.Style = smsLabelPercent
|
Marks.Style = smsLabelPercent
|
||||||
FixedRadius = 100
|
Exploded = True
|
||||||
MarkPositions = pmpLeftRight
|
MarkPositions = pmpLeftRight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -112,6 +120,7 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
Top = 204
|
Top = 204
|
||||||
Width = 551
|
Width = 551
|
||||||
Align = alTop
|
Align = alTop
|
||||||
|
OnCanResize = Splitter1CanResize
|
||||||
OnMoved = Splitter1Moved
|
OnMoved = Splitter1Moved
|
||||||
ResizeAnchor = akTop
|
ResizeAnchor = akTop
|
||||||
end
|
end
|
||||||
|
@ -168,38 +177,37 @@ inherited CEProfileViewerWidget: TCEProfileViewerWidget
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
inherited contextMenu: TPopupMenu
|
inherited contextMenu: TPopupMenu
|
||||||
left = 16
|
left = 8
|
||||||
top = 152
|
top = 48
|
||||||
end
|
end
|
||||||
object pieTools: TChartToolset[2]
|
object datNumCalls: TListChartSource[2]
|
||||||
left = 192
|
|
||||||
top = 112
|
|
||||||
object pieToolsZoomMouseWheelTool1: TZoomMouseWheelTool
|
|
||||||
ZoomFactor = 2
|
|
||||||
ZoomRatio = 2
|
|
||||||
end
|
|
||||||
object pieToolsPanDragTool1: TPanDragTool
|
|
||||||
Shift = [ssRight]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
object datNumCalls: TListChartSource[3]
|
|
||||||
Sorted = True
|
Sorted = True
|
||||||
left = 192
|
left = 192
|
||||||
top = 56
|
top = 56
|
||||||
end
|
end
|
||||||
object datTreeTime: TListChartSource[4]
|
object datTreeTime: TListChartSource[3]
|
||||||
Sorted = True
|
Sorted = True
|
||||||
left = 232
|
left = 232
|
||||||
top = 56
|
top = 56
|
||||||
end
|
end
|
||||||
object datFuncTime: TListChartSource[5]
|
object datFuncTime: TListChartSource[4]
|
||||||
Sorted = True
|
Sorted = True
|
||||||
left = 272
|
left = 272
|
||||||
top = 56
|
top = 56
|
||||||
end
|
end
|
||||||
object datPerCall: TListChartSource[6]
|
object datPerCall: TListChartSource[5]
|
||||||
Sorted = True
|
Sorted = True
|
||||||
left = 312
|
left = 312
|
||||||
top = 56
|
top = 56
|
||||||
end
|
end
|
||||||
|
object ImageList1: TImageList[6]
|
||||||
|
left = 192
|
||||||
|
top = 120
|
||||||
|
end
|
||||||
|
object ChartToolset1: TChartToolset[7]
|
||||||
|
left = 232
|
||||||
|
top = 120
|
||||||
|
object ChartToolset1DataPointHintTool1: TDataPointHintTool
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,8 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, TASources, TAGraph, TATransformations, TASeries,
|
Classes, SysUtils, FileUtil, TASources, TAGraph, TATransformations, TASeries,
|
||||||
TATools, Forms, Controls, Graphics, Dialogs, ExtCtrls, Menus, ComCtrls,
|
TATools, Forms, Controls, Graphics, Dialogs, ExtCtrls, Menus, ComCtrls,
|
||||||
StdCtrls, ce_widget, ce_common, ce_stringrange, ce_dsgncontrols, ce_ddemangle;
|
StdCtrls, TALegend, TADrawUtils, math,
|
||||||
|
ce_widget, ce_common, ce_stringrange, ce_dsgncontrols, ce_ddemangle;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -15,10 +16,10 @@ type
|
||||||
btnOpen: TCEToolButton;
|
btnOpen: TCEToolButton;
|
||||||
btnRefresh: TCEToolButton;
|
btnRefresh: TCEToolButton;
|
||||||
button0: TCEToolButton;
|
button0: TCEToolButton;
|
||||||
|
ChartToolset1: TChartToolset;
|
||||||
|
ChartToolset1DataPointHintTool1: TDataPointHintTool;
|
||||||
|
ImageList1: TImageList;
|
||||||
selPieSource: TComboBox;
|
selPieSource: TComboBox;
|
||||||
pieTools: TChartToolset;
|
|
||||||
pieToolsPanDragTool1: TPanDragTool;
|
|
||||||
pieToolsZoomMouseWheelTool1: TZoomMouseWheelTool;
|
|
||||||
datNumCalls: TListChartSource;
|
datNumCalls: TListChartSource;
|
||||||
datTreeTime: TListChartSource;
|
datTreeTime: TListChartSource;
|
||||||
datFuncTime: TListChartSource;
|
datFuncTime: TListChartSource;
|
||||||
|
@ -30,11 +31,18 @@ type
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
procedure btnOpenClick(Sender: TObject);
|
procedure btnOpenClick(Sender: TObject);
|
||||||
procedure btnRefreshClick(Sender: TObject);
|
procedure btnRefreshClick(Sender: TObject);
|
||||||
|
procedure pieDrawLegend(ASender: TChart; ADrawer: IChartDrawer;
|
||||||
|
ALegendItems: TChartLegendItems; ALegendItemSize: TPoint;
|
||||||
|
const ALegendRect: TRect; AColCount, ARowCount: Integer);
|
||||||
|
procedure pieSeriesGetMark(out AFormattedMark: String; AIndex: Integer);
|
||||||
procedure selPieSourceSelect(Sender: TObject);
|
procedure selPieSourceSelect(Sender: TObject);
|
||||||
procedure selPieSourceSelectionChange(Sender: TObject; User: boolean);
|
procedure selPieSourceSelectionChange(Sender: TObject; User: boolean);
|
||||||
|
procedure Splitter1CanResize(Sender: TObject; var NewSize: Integer;
|
||||||
|
var Accept: Boolean);
|
||||||
procedure Splitter1Moved(Sender: TObject);
|
procedure Splitter1Moved(Sender: TObject);
|
||||||
private
|
private
|
||||||
logFname: string;
|
logFname: string;
|
||||||
|
procedure updateIcons;
|
||||||
procedure clearViewer;
|
procedure clearViewer;
|
||||||
procedure updateFromFile(const fname: string);
|
procedure updateFromFile(const fname: string);
|
||||||
procedure updatePie;
|
procedure updatePie;
|
||||||
|
@ -52,6 +60,7 @@ begin
|
||||||
clearViewer;
|
clearViewer;
|
||||||
updatePie;
|
updatePie;
|
||||||
list.OnCompare:=@listCompare;
|
list.OnCompare:=@listCompare;
|
||||||
|
selPieSourceSelect(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.btnRefreshClick(Sender: TObject);
|
procedure TCEProfileViewerWidget.btnRefreshClick(Sender: TObject);
|
||||||
|
@ -71,9 +80,29 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProfileViewerWidget.pieDrawLegend(ASender: TChart;
|
||||||
|
ADrawer: IChartDrawer; ALegendItems: TChartLegendItems;
|
||||||
|
ALegendItemSize: TPoint; const ALegendRect: TRect; AColCount,
|
||||||
|
ARowCount: Integer);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEProfileViewerWidget.pieSeriesGetMark(out AFormattedMark: String;
|
||||||
|
AIndex: Integer);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.selPieSourceSelect(Sender: TObject);
|
procedure TCEProfileViewerWidget.selPieSourceSelect(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
updatePie;
|
case selPieSource.ItemIndex of
|
||||||
|
1: pieSeries.Source := datTreeTime;
|
||||||
|
2: pieSeries.Source := datFuncTime;
|
||||||
|
3: pieSeries.Source := datPerCall;
|
||||||
|
else pieSeries.Source := datNumCalls;
|
||||||
|
end;
|
||||||
|
updateIcons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.btnOpenClick(Sender: TObject);
|
procedure TCEProfileViewerWidget.btnOpenClick(Sender: TObject);
|
||||||
|
@ -94,13 +123,7 @@ end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.updatePie;
|
procedure TCEProfileViewerWidget.updatePie;
|
||||||
begin
|
begin
|
||||||
case selPieSource.ItemIndex of
|
pieSeries.FixedRadius:= max(1, pie.Height div 2 - 10);
|
||||||
1: pieSeries.ListSource.DataPoints.Assign(datTreeTime.DataPoints);
|
|
||||||
2: pieSeries.ListSource.DataPoints.Assign(datFuncTime.DataPoints);
|
|
||||||
3: pieSeries.ListSource.DataPoints.Assign(datPerCall.DataPoints);
|
|
||||||
else pieSeries.ListSource.DataPoints.Assign(datNumCalls.DataPoints);
|
|
||||||
end;
|
|
||||||
pieSeries.FixedRadius:= pie.Height div 2 - 10;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.selPieSourceSelectionChange(Sender: TObject;User: boolean);
|
procedure TCEProfileViewerWidget.selPieSourceSelectionChange(Sender: TObject;User: boolean);
|
||||||
|
@ -108,6 +131,13 @@ begin
|
||||||
updatePie;
|
updatePie;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProfileViewerWidget.Splitter1CanResize(Sender: TObject;
|
||||||
|
var NewSize: Integer; var Accept: Boolean);
|
||||||
|
begin
|
||||||
|
if accept then
|
||||||
|
updatePie;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.Splitter1Moved(Sender: TObject);
|
procedure TCEProfileViewerWidget.Splitter1Moved(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
updatePie;
|
updatePie;
|
||||||
|
@ -123,6 +153,33 @@ begin
|
||||||
datPerCall.Clear;
|
datPerCall.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProfileViewerWidget.updateIcons;
|
||||||
|
var
|
||||||
|
b: TBitmap;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
ImageList1.Clear;
|
||||||
|
b := TBitmap.Create;
|
||||||
|
try
|
||||||
|
for i:= 0 to pieSeries.Count-1 do
|
||||||
|
begin
|
||||||
|
b.SetSize(12,12);
|
||||||
|
b.Canvas.Brush.Color := pieSeries.GetColor(i);
|
||||||
|
b.Canvas.Pen.Color:= clblack;
|
||||||
|
b.Canvas.Brush.Style := bsSolid;
|
||||||
|
b.Canvas.Pen.Style := psSolid;
|
||||||
|
b.Canvas.Pen.Width := 1;
|
||||||
|
b.Transparent := false;
|
||||||
|
b.Canvas.Rectangle(Rect(0,0,12,12));
|
||||||
|
ImageList1.Add(b, nil);
|
||||||
|
list.Items.Item[i].ImageIndex:=i;
|
||||||
|
b.Clear;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
b.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEProfileViewerWidget.updateFromFile(const fname: string);
|
procedure TCEProfileViewerWidget.updateFromFile(const fname: string);
|
||||||
var
|
var
|
||||||
log: string;
|
log: string;
|
||||||
|
@ -137,17 +194,20 @@ var
|
||||||
procedure fillRow();
|
procedure fillRow();
|
||||||
var
|
var
|
||||||
itm: TListItem;
|
itm: TListItem;
|
||||||
|
c: TColor;
|
||||||
begin
|
begin
|
||||||
list.AddItem(fnc.ToString, nil);
|
list.AddItem('', nil);
|
||||||
itm := list.Items[list.Items.Count-1];
|
itm := list.Items[list.Items.Count-1];
|
||||||
|
itm.SubItems.Add(fnc.ToString);
|
||||||
itm.SubItems.Add(fft.ToString);
|
itm.SubItems.Add(fft.ToString);
|
||||||
itm.SubItems.Add(ftt.ToString);
|
itm.SubItems.Add(ftt.ToString);
|
||||||
itm.SubItems.Add(fpc.ToString);
|
itm.SubItems.Add(fpc.ToString);
|
||||||
itm.SubItems.Add(idt);
|
itm.SubItems.Add(idt);
|
||||||
datNumCalls.Add(100, fnc, idt);
|
c := Random($70F0F0F0) + $F0F0F0F;
|
||||||
datFuncTime.Add(100, fft, idt);
|
datNumCalls.Add(0, fnc, idt, c);
|
||||||
datTreeTime.Add(100, ftt, idt);
|
datFuncTime.Add(0, fft, idt, c);
|
||||||
datPerCall.Add(100, fpc, idt);
|
datTreeTime.Add(0, ftt, idt, c);
|
||||||
|
datPerCall.Add(0, fpc, idt, c);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -235,7 +295,7 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
list.EndUpdate;
|
list.EndUpdate;
|
||||||
updatePie;
|
selPieSourceSelect(nil);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -245,26 +305,18 @@ var
|
||||||
col: Integer;
|
col: Integer;
|
||||||
begin
|
begin
|
||||||
col := list.SortColumn;
|
col := list.SortColumn;
|
||||||
if col = 4 then
|
if col = 5 then
|
||||||
begin
|
begin
|
||||||
Compare := AnsiCompareStr(item1.SubItems[3], item2.SubItems[3]);
|
Compare := AnsiCompareStr(item1.SubItems[3], item2.SubItems[3]);
|
||||||
end
|
end
|
||||||
else
|
else if col <> 0 then
|
||||||
begin
|
begin
|
||||||
if col = 0 then
|
i1 := item1.SubItems[col-1].ToInt64;
|
||||||
begin
|
i2 := item2.SubItems[col-1].ToInt64;
|
||||||
i1 := item1.Caption.ToInt64;
|
if (i1 = i2) then
|
||||||
i2 := item2.Caption.ToInt64;
|
Compare := 0
|
||||||
end
|
else if (i1 < i2) then
|
||||||
else
|
Compare := -1
|
||||||
begin
|
|
||||||
i1 := item1.SubItems[col-1].ToInt64;
|
|
||||||
i2 := item2.SubItems[col-1].ToInt64;
|
|
||||||
end;
|
|
||||||
if (i1 = i2)
|
|
||||||
then Compare := 0
|
|
||||||
else if (i1 < i2)
|
|
||||||
then Compare := -1
|
|
||||||
else
|
else
|
||||||
Compare := 1;
|
Compare := 1;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue