示例#1
0
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
0
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
0
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;
}