-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ftime-trace: add tracing of CTFE ! (#4339)
- Loading branch information
1 parent
7419434
commit 15da933
Showing
4 changed files
with
153 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Test --ftime-trace functionality: CTFE | ||
|
||
// RUN: %ldc -c --ftime-trace --ftime-trace-granularity=100 --ftime-trace-file=%t.1 %s && FileCheck %s < %t.1 | ||
|
||
// CHECK: traceEvents | ||
|
||
// CHECK-DAG: CTFE func: mulmul | ||
// CHECK-DAG: CTFE start: Thing | ||
// CHECK-DAG: CTFE func: muloddmul | ||
// CHECK-DAG: ExecuteCompiler | ||
|
||
module ftimetrace; | ||
|
||
int mulmul(int i) { | ||
int mul = 666; | ||
for (; i > 0; i--) | ||
{ | ||
mul *= i; | ||
} | ||
return mul; | ||
} | ||
|
||
|
||
int times(int mul, int i){ | ||
return mul * i; | ||
} | ||
|
||
int muloddmul(int i) { | ||
int mul = 666; | ||
for (; i > 0; i--) | ||
{ | ||
mul = times(mul, i); | ||
} | ||
return mul; | ||
} | ||
|
||
struct Thing { | ||
int m; | ||
this(int i) { | ||
if (i % 2) { | ||
m = muloddmul(i); | ||
} else { | ||
m = mulmul(i); | ||
} | ||
} | ||
} | ||
|
||
static immutable Thing thing = Thing(123000); | ||
|
||
int foo() { | ||
auto thing2 = new Thing(123001); | ||
return 1; | ||
} | ||
|
||
enum f = foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters