Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Replace uses of TickDuration with MonoTime.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdavis committed Jul 30, 2014
1 parent 59a68b0 commit d681cad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
9 changes: 3 additions & 6 deletions src/core/time.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,10 @@ ulong mach_absolute_time();

}

version(unittest)
//To verify that an lvalue isn't required.
version(unittest) T copy(T)(T t)
{
//To verify that an lvalue isn't required.
T copy(T)(T t)
{
return t;
}
return t;
}


Expand Down
10 changes: 6 additions & 4 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ debug(PRINTF_TO_FILE)
{
import core.time;

private __gshared TickDuration gcStartTick;
private __gshared MonoTime gcStartTick;
private __gshared FILE* gcx_fh;

private int printf(ARGS...)(const char* fmt, ARGS args) nothrow
{
if (gcStartTick == TickDuration.zero)
gcStartTick = TickDuration.currSystemTick;
if (gcStartTick == MonoTime.init)
gcStartTick = MonoTime.currTime;
if (!gcx_fh)
gcx_fh = fopen("gcx.log", "w");
int len = fprintf(gcx_fh, "%10.6lf: ", (TickDuration.currSystemTick - gcStartTick).to!("seconds", double));
immutable timeElapsed = MonoTime.currTime - gcStartTick;
immutable secondsAsDouble = diff.total!"hnsecs" / cast(double)convert!("seconds", "hnsecs")(1);
int len = fprintf(gcx_fh, "%10.6lf: ", secondsAsDouble);
len += fprintf(gcx_fh, fmt, args);
fflush(gcx_fh);
return len;
Expand Down
8 changes: 4 additions & 4 deletions src/test_runner.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import core.runtime, core.time : TickDuration;
import core.runtime, core.time : MonoTime;
import core.stdc.stdio;

immutable(ModuleInfo*) getModuleInfo(string name)
Expand All @@ -22,10 +22,10 @@ bool tester()
{
try
{
immutable t0 = TickDuration.currSystemTick;
immutable t0 = MonoTime.currTime;
fp();
immutable t1 = TickDuration.currSystemTick;
printf("%.3fs PASS %.*s\n", (t1 - t0).msecs / 1000.,
immutable t1 = MonoTime.currTime;
printf("%.3fs PASS %.*s\n", (t1 - t0).total!"msecs" / 1000.0,
cast(int)name.length, name.ptr);
}
catch (Throwable e)
Expand Down

0 comments on commit d681cad

Please sign in to comment.