MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / snprintfTime

Function snprintfTime

runtime/Perf.cc:982–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980}
981
982double snprintfTime()
983{
984 struct timespec now;
985 int count = 1000000;
986 char buffer[1000];
987
988 clock_gettime(CLOCK_REALTIME, &now);
989 uint64_t start = Cycles::rdtsc();
990 Util::serialize();
991 for (int i = 0; i < count; ++i) {
992 snprintf(buffer, 1000, "%010lu.%09lu", now.tv_sec, now.tv_nsec);
993 }
994 Util::serialize();
995 uint64_t stop = Cycles::rdtsc();
996
997 return Cycles::toSeconds(stop - start)/count;
998}
999
1000double snprintStatic100Char()
1001{

Callers

nothing calls this directly

Calls 2

rdtscFunction · 0.85
serializeFunction · 0.70

Tested by

no test coverage detected