MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / get_process_times

Function get_process_times

src/common/utils.cpp:1087–1119  ·  view source on GitHub ↗

returns system and user time in milliseconds that process runs

Source from the content-addressed store, hash-verified

1085
1086// returns system and user time in milliseconds that process runs
1087void get_process_times(SINT64 &userTime, SINT64 &sysTime)
1088{
1089#if defined(WIN_NT)
1090 FILETIME utime, stime, dummy;
1091 if (GetProcessTimes(GetCurrentProcess(), &dummy, &dummy, &stime, &utime))
1092 {
1093 LARGE_INTEGER bigint;
1094
1095 bigint.HighPart = stime.dwHighDateTime;
1096 bigint.LowPart = stime.dwLowDateTime;
1097 sysTime = bigint.QuadPart / 10000;
1098
1099 bigint.HighPart = utime.dwHighDateTime;
1100 bigint.LowPart = utime.dwLowDateTime;
1101 userTime = bigint.QuadPart / 10000;
1102 }
1103 else
1104 {
1105 sysTime = userTime = 0;
1106 }
1107#else
1108 ::tms tus;
1109 if (times(&tus) == (clock_t)(-1))
1110 {
1111 sysTime = userTime = 0;
1112 return;
1113 }
1114
1115 const int TICK = sysconf(_SC_CLK_TCK);
1116 sysTime = SINT64(tus.tms_stime) * 1000 / TICK;
1117 userTime = SINT64(tus.tms_utime) * 1000 / TICK;
1118#endif
1119}
1120
1121
1122void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool append)

Callers 1

getPerfCountersMethod · 0.85

Calls 2

GetProcessTimesFunction · 0.85
timesFunction · 0.50

Tested by

no test coverage detected