{"latency-avg10000", &latencyAvg10000}, {"latency-avg1000000", &latencyAvg1000000},
{"uptime", uptimeOfProcess},
{"real-memory-usage", getRealMemoryUsage},
+ {"cpu-user-msec", getCPUTimeUser},
+ {"cpu-sys-msec", getCPUTimeSystem},
{"fd-usage", getOpenFileDescriptors}
};
};
return 0;
#endif
}
+
+uint64_t getCPUTimeUser(const std::string&)
+{
+ struct rusage ru;
+ getrusage(RUSAGE_SELF, &ru);
+ return (ru.ru_utime.tv_sec*1000ULL + ru.ru_utime.tv_usec/1000);
+}
+
+uint64_t getCPUTimeSystem(const std::string&)
+{
+ struct rusage ru;
+ getrusage(RUSAGE_SELF, &ru);
+ return (ru.ru_stime.tv_sec*1000ULL + ru.ru_stime.tv_usec/1000);
+}
uint64_t getRealMemoryUsage(const std::string&);
uint64_t getOpenFileDescriptors(const std::string&);
+uint64_t getCPUTimeUser(const std::string&);
+uint64_t getCPUTimeSystem(const std::string&);
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)