Trying it with process.memory().usage inserted.
function ReadObjectFile(fname){ return JSON.parse(require("fs").readFileSync(fname)); }//end ReadObjectFile function TestIt(){ var j=0; console.log(j," ",process.memory().usage);j++; var T= new (require("TimeObj"))(); console.log(j," ",process.memory().usage);j++; T.updateTime(); //start the stopwatch T.SWstart(); // output day of the week console.log(T.getDay()); Cal=new (require("CalObj"))(ReadObjectFile("Mycalibrations.cal")); console.log(j," ",process.memory().usage);j++; Log=new (require("LogObj"))(ReadObjectFile("Mylog1.cfg"),Cal,T); console.log(j," ",process.memory().usage);j++; Log1=new (require("LogObj"))(ReadObjectFile("Mylog2.cfg"),Cal,T); console.log(j," ",process.memory().usage);j++; Log2=new (require("LogObj"))(ReadObjectFile("Mylog3.cfg"),Cal,T); console.log(j," ",process.memory().usage);j++; //Changes to the onjects can be masde // Log1.A.Interval=3000; // Log1.A.Fname="xx1.csv"; //start the logging Log.doHeaders(); Log.start(); console.log(j," ",process.memory().usage);j++; Log1.doHeaders(); Log1.start(); console.log(j," ",process.memory().usage);j++; Log2.doHeaders(); Log2.start(); // output the elapsed time console.log(T.SWstop().toFixed(3)," ms"); console.log(j," ",process.memory().usage);j++; }//end TestIt setBusyIndicator(LED1); TestIt();
The output:
>echo(0); 0 445 1 453 Sat 2 571 3 717 4 827 5 937 6 958 7 975 418.646 ms 8 997 =undefined xx1.csv Finished 10472.984 ms xx2.csv Finished 20561.429 ms xx3.csv Finished 30603.546 ms >console.log(process.memory().usage); 957 =undefined >
@ClearMemory041063 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Trying it with process.memory().usage inserted.
The output: