Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1f919a

Browse files
committed
Hardcode MAX_TRACES and MAX_TRACERS
1 parentb046572 commita1f919a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

‎include/Tracer.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
#include<string>
55
#include<fstream>
6-
#include<cstdlib>
76
#include<nlohmann/json.hpp>
87

8+
#defineMAX_TRACES1000000
9+
#defineMAX_TRACERS100
10+
911
classTracer {
1012
protected:
1113
using string = std::string;
@@ -15,9 +17,6 @@ class Tracer {
1517
staticint tracerCount;
1618
static json traces;
1719

18-
staticconstlong maxTraces;
19-
staticconstlong maxTracers;
20-
2120
static stringaddTracer(string className, string title) {
2221
string key =std::to_string(tracerCount++) +"-" + className +"-" + title;
2322
string method ="construct";
@@ -32,8 +31,8 @@ class Tracer {
3231
{"method", method},
3332
{"args", args},
3433
});
35-
if (traces.size() >maxTraces)throwstd::overflow_error("Traces Limit Exceeded");
36-
if (tracerCount >maxTracers)throwstd::overflow_error("Tracers Limit Exceeded");
34+
if (traces.size() >MAX_TRACES)throwstd::overflow_error("Traces Limit Exceeded");
35+
if (tracerCount >MAX_TRACERS)throwstd::overflow_error("Tracers Limit Exceeded");
3736
}
3837

3938
string key;
@@ -54,9 +53,6 @@ class Tracer {
5453
int Tracer::tracerCount =0;
5554
nlohmann::json Tracer::traces = json::array();
5655

57-
constlong Tracer::maxTraces = std::stol(getenv("MAX_TRACES"));
58-
constlong Tracer::maxTracers = std::stol(getenv("MAX_TRACERS"));
59-
6056
intinit() {
6157
atexit(Tracer::onExit);
6258
return0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp