MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / Start

Method Start

source/util/timer.cpp:43–52  ·  view source on GitHub ↗

Do not change the order of invoking system calls. We want to make CPU/Wall time correct as much as possible. Calling functions to get CPU/Wall time must closely surround the target code of measuring.

Source from the content-addressed store, hash-verified

41// time correct as much as possible. Calling functions to get CPU/Wall time must
42// closely surround the target code of measuring.
43void Timer::Start() {
44 if (report_stream_) {
45 if (getrusage(RUSAGE_SELF, &usage_before_) == -1)
46 usage_status_ |= kGetrusageFailed;
47 if (clock_gettime(CLOCK_MONOTONIC, &wall_before_) == -1)
48 usage_status_ |= kClockGettimeWalltimeFailed;
49 if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cpu_before_) == -1)
50 usage_status_ |= kClockGettimeCPUtimeFailed;
51 }
52}
53
54// The order of invoking system calls is important with the same reason as
55// Timer::Start().

Callers 2

ScopedTimerMethod · 0.45
TESTFunction · 0.45

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.36