-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init global variables once at dlopen
PR-URL: #124 Reviewed-BY: hyj1991 <[email protected]>
- Loading branch information
1 parent
5278a3a
commit 6848552
Showing
8 changed files
with
75 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
#ifndef _SRC_LIBRARY_COMMON_H | ||
#define _SRC_LIBRARY_COMMON_H | ||
#ifndef XPROFILER_SRC_LIBRARY_COMMON_H | ||
#define XPROFILER_SRC_LIBRARY_COMMON_H | ||
|
||
#include "json.hpp" | ||
|
||
namespace xprofiler { | ||
using nlohmann::json; | ||
using std::function; | ||
using std::string; | ||
|
||
// xprofiler logger | ||
enum LOG_LEVEL { LOG_INFO, LOG_ERROR, LOG_DEBUG }; | ||
enum LOG_TYPE { LOG_TO_FILE, LOG_TO_TTL }; | ||
|
||
// global variables | ||
void InitGlobalVariables(); | ||
string GetGlobalNodeVersion(); | ||
void InitOnceLoadTime(); | ||
|
||
// uptime | ||
unsigned long GetUptime(); | ||
string GetStartTime(string format); | ||
std::string GetStartTime(std::string format); | ||
|
||
// commands | ||
#define COMMAND_CALLBACK(cb) \ | ||
void cb(json command, string (*format)(const char *, ...), \ | ||
function<void(json)> success, function<void(string)> error) | ||
#define COMMAND_CALLBACK(cb) \ | ||
void cb(nlohmann::json command, std::string (*format)(const char *, ...), \ | ||
std::function<void(nlohmann::json)> success, \ | ||
std::function<void(std::string)> error) | ||
} // namespace xprofiler | ||
|
||
#endif | ||
#endif /* XPROFILER_SRC_LIBRARY_COMMON_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters