Skip to content

Commit a1f919a

Browse files
committed
Hardcode MAX_TRACES and MAX_TRACERS
1 parent b046572 commit a1f919a

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+
#define MAX_TRACES 1000000
9+
#define MAX_TRACERS 100
10+
911
class Tracer {
1012
protected:
1113
using string = std::string;
@@ -15,9 +17,6 @@ class Tracer {
1517
static int tracerCount;
1618
static json traces;
1719

18-
static const long maxTraces;
19-
static const long maxTracers;
20-
2120
static string addTracer(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) throw std::overflow_error("Traces Limit Exceeded");
36-
if (tracerCount > maxTracers) throw std::overflow_error("Tracers Limit Exceeded");
34+
if (traces.size() > MAX_TRACES) throw std::overflow_error("Traces Limit Exceeded");
35+
if (tracerCount > MAX_TRACERS) throw std::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-
const long Tracer::maxTraces = std::stol(getenv("MAX_TRACES"));
58-
const long Tracer::maxTracers = std::stol(getenv("MAX_TRACERS"));
59-
6056
int init() {
6157
atexit(Tracer::onExit);
6258
return 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy