Skip to content
This repository was archived by the owner on Aug 13, 2020. It is now read-only.

Commit cb0c09d

Browse files
Change profiling unit from us to cycles and intoduce padding
This patch fixes the profiler-outptut form looking like this ``` 5078127277490292274277443610704 54635 int ocean.sys.Epoll.Epoll.wait(ocean.sys.Epoll.epoll_event_t[], int) ``` to looking like this ``` 507812727749 02922742774 43610704 54635 int ocean.sys.Epoll.Epoll.wait(ocean.sys.Epoll.epoll_event_t[], int) ``` Because it is hard to get the cpu frequency under linux, the profiler uses a hard-coded frequency (3mhz) when running linux. Thereby introducing misleading information into the perforamnce-profile. We are circumventing the problem by printing cycles instead of us, and fix the ouput to included the nessersy left-padding for the larger figures.
1 parent 99c99a1 commit cb0c09d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From 0fc4b3e9e23618412f8f7ced13adadd502da307f Mon Sep 17 00:00:00 2001
2+
From: Stefan Koch <stefan.koch@sociomantic.com>
3+
Date: Fri, 26 Apr 2019 18:18:27 +0200
4+
Subject: [PATCH 15/15] Fix profile to report cycles
5+
6+
---
7+
src/rt/trace.d | 14 +++++++-------
8+
1 file changed, 7 insertions(+), 7 deletions(-)
9+
10+
diff --git a/src/rt/trace.d b/src/rt/trace.d
11+
index 07fd333..1695292 100644
12+
--- a/src/rt/trace.d
13+
+++ b/src/rt/trace.d
14+
@@ -292,9 +292,9 @@ private void trace_times(FILE* fplog, Symbol*[] psymbols)
15+
// Print array
16+
timer_t freq;
17+
QueryPerformanceFrequency(&freq);
18+
- fprintf(fplog,"\n======== Timer Is %lld Ticks/Sec, Times are in Microsecs ========\n\n",freq);
19+
- fprintf(fplog," Num Tree Func Per\n");
20+
- fprintf(fplog," Calls Time Time Call\n\n");
21+
+ fprintf(fplog,"\n======== Timings are in raw TSC Ticks ========\n\n",freq);
22+
+ fprintf(fplog," Num Tree Func Per\n");
23+
+ fprintf(fplog," Calls Time Time Call\n\n");
24+
foreach (s; psymbols)
25+
{
26+
timer_t tl,tr;
27+
@@ -313,12 +313,12 @@ private void trace_times(FILE* fplog, Symbol*[] psymbols)
28+
if (calls == 0)
29+
calls = 1;
30+
31+
- tl = (s.totaltime * 1000000) / freq;
32+
- fl = (s.functime * 1000000) / freq;
33+
+ tl = s.totaltime;
34+
+ fl = s.functime;
35+
percall = s.functime / calls;
36+
- pl = (s.functime * 1000000) / calls / freq;
37+
+ pl = s.functime / calls;
38+
39+
- fprintf(fplog,"%7llu%12lld%12lld%12lld %.*s\n",
40+
+ fprintf(fplog,"%10llu %20lld %20lld %20lld %.*s\n",
41+
calls, tl, fl, pl, id.length, id.ptr);
42+
}
43+
}
44+
--
45+
2.7.4
46+

0 commit comments

Comments
 (0)