Content-Length: 351229 | pFad | http://github.com/algorithm-visualizer/tracers.js/commit/e0c5b1406bb3c67e20bb47f33dda4ded970f8bb7

26 Make cpp tracers load limits from environment variables · algorithm-visualizer/tracers.js@e0c5b14 · GitHub
Skip to content

Commit e0c5b14

Browse files
committed
Make cpp tracers load limits from environment variables
1 parent 2dbde05 commit e0c5b14

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

languages/cpp/src/Randomize.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ namespace Randomize {
139139
return *this;
140140
}
141141

142+
// TODO: fix array1d/2d/graph randomizers returning pointer instead of array
142143
T *create() {
143144
T *D = new T[_N];
144145
for (int i = 0; i < _N; i++) {

languages/cpp/src/Tracer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <string>
22
#include <fstream>
3+
#include <cstdlib>
34
#include <json.hpp>
45
#include "Tracer.h"
56

@@ -9,6 +10,9 @@ using json = nlohmann::json;
910
int Tracer::tracerCount = 0;
1011
json Tracer::traces = json::array();
1112

13+
const long Tracer::maxTraces = stol(getenv("MAX_TRACES"));
14+
const long Tracer::maxTracers = stol(getenv("MAX_TRACERS"));
15+
1216
string Tracer::addTracer(string className, string title) {
1317
string key = to_string(tracerCount++) + "-" + className + "-" + title;
1418
string method = "construct";

languages/cpp/src/Tracer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class Tracer {
1313
static int tracerCount;
1414
static json traces;
1515

16-
static const int maxTraces = 1000000; // TODO: load from environment variables
17-
static const int maxTracers = 100;
16+
static const long maxTraces;
17+
static const long maxTracers;
1818

1919
static string addTracer(string className, string title);
2020

specs/tracers/LogTracer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default {
2626
return: 'LogTracer',
2727
arguments: [],
2828
}, {
29-
name: 'print',
29+
name: 'print', // TODO: separate into println and print methods
3030
description: 'Print `message`.',
3131
return: 'LogTracer',
3232
arguments: [

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/algorithm-visualizer/tracers.js/commit/e0c5b1406bb3c67e20bb47f33dda4ded970f8bb7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy