Network-metrics (#1994)
* Add a couple quick functions for converting a uint64_t network ID/node ID into std::string * Network metrics
This commit is contained in:
parent
a43048a1ad
commit
925599cab0
6 changed files with 71 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
|
@ -66,6 +67,18 @@ unsigned int OSUtils::ztsnprintf(char *buf,unsigned int len,const char *fmt,...)
|
|||
return (unsigned int)n;
|
||||
}
|
||||
|
||||
std::string OSUtils::networkIDStr(const uint64_t nwid) {
|
||||
char tmp[32] = {};
|
||||
ztsnprintf(tmp, sizeof(tmp), "%.16" PRIx64, nwid);
|
||||
return std::string(tmp);
|
||||
}
|
||||
|
||||
std::string OSUtils::nodeIDStr(const uint64_t nid) {
|
||||
char tmp[32] = {};
|
||||
ztsnprintf(tmp, sizeof(tmp), "%.10" PRIx64, nid);
|
||||
return std::string(tmp);
|
||||
}
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
bool OSUtils::redirectUnixOutputs(const char *stdoutPath,const char *stderrPath)
|
||||
throw()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue