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

Commit 93a52ec

Browse files
Add Patch to correct Profiler output always put spaces between values
Also the printing is corrected from using %lld to using %llu to avoid seeing negative numbers in cases where we'd overflow This commit also removed a previously unused variable
1 parent 99c99a1 commit 93a52ec

File tree

1 file changed

+51
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)