本文整理汇总了C++中Transport::getCpuTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Transport::getCpuTime方法的具体用法?C++ Transport::getCpuTime怎么用?C++ Transport::getCpuTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transport
的用法示例。
在下文中一共展示了Transport::getCpuTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: f_hphp_get_timers
Variant f_hphp_get_timers(bool get_as_float /* = true */) {
Transport *transport = g_context->getTransport();
if (transport == NULL) {
return false;
}
const timespec &tsQueue = transport->getQueueTime();
const timespec &tsWall = transport->getWallTime();
const timespec &tsCpu = transport->getCpuTime();
const int64_t &instStart = transport->getInstructions();
const int64_t &usleep_time = transport->getuSleepTime();
const int64_t &sleep_time = transport->getSleepTime();
const int64_t &nsleep_time_s = transport->getnSleepTimeS();
const int32_t &nsleep_time_n = transport->getnSleepTimeN();
ArrayInit ret(7);
if (get_as_float) {
ret.set(s_queue, ts_float(tsQueue));
ret.set(s_process_wall, ts_float(tsWall));
ret.set(s_process_cpu, ts_float(tsCpu));
} else {
ret.set(s_queue, ts_microtime(tsQueue));
ret.set(s_process_wall, ts_microtime(tsWall));
ret.set(s_process_cpu, ts_microtime(tsCpu));
}
ret.set(s_process_inst, instStart);
ret.set(s_process_sleep_time, sleep_time);
ret.set(s_process_usleep_time, (double)usleep_time/1000000);
ret.set(s_process_nsleep_time, nsleep_time_s +
(double)nsleep_time_n / 1000000000);
return ret.create();
}
示例2: f_hphp_get_timers
Variant f_hphp_get_timers(bool get_as_float /* = true */) {
Transport *transport = g_context->getTransport();
if (transport == NULL) {
return false;
}
const timespec &tsQueue = transport->getQueueTime();
const timespec &tsWall = transport->getWallTime();
const timespec &tsCpu = transport->getCpuTime();
const int64_t &instStart = transport->getInstructions();
ArrayInit ret(4);
if (get_as_float) {
ret.set(s_queue, ts_float(tsQueue));
ret.set(s_process_wall, ts_float(tsWall));
ret.set(s_process_cpu, ts_float(tsCpu));
} else {
ret.set(s_queue, ts_microtime(tsQueue));
ret.set(s_process_wall, ts_microtime(tsWall));
ret.set(s_process_cpu, ts_microtime(tsCpu));
}
ret.set(s_process_inst, instStart);
return ret.create();
}
示例3: f_hphp_get_timers
Variant f_hphp_get_timers(bool get_as_float /* = true */) {
Transport *transport = g_context->getTransport();
if (transport == NULL) {
return false;
}
const timespec &tsQueue = transport->getQueueTime();
const timespec &tsWall = transport->getWallTime();
const timespec &tsCpu = transport->getCpuTime();
const int64_t &instStart = transport->getInstructions();
Array ret;
if (get_as_float) {
ret.set("queue", ts_float(tsQueue));
ret.set("process-wall", ts_float(tsWall));
ret.set("process-cpu", ts_float(tsCpu));
} else {
ret.set("queue", ts_microtime(tsQueue));
ret.set("process-wall", ts_microtime(tsWall));
ret.set("process-cpu", ts_microtime(tsCpu));
}
ret.set("process-inst", instStart);
return ret;
}