You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I posted this on Google Group but it may be a bug so I am posting it again here,
=Gerry=
Hi,
I am trying to use process.stdout.write to put a line to the console without generating a newline from Cloud9 on a Beaglebone Black. The reason I am doing this is that I am running a series of benchmarks and I want to put out a message ("benchmark #1 : ") to the console when I enter the benchmark function and then at the end of the benchmark function put out the number of milliseconds it took with the unit of measure ('235 ms\n') so that if I look at the console while I am running a series of benchmarks it would look like this:
benchmark took 19458 nanoseconds
benchmark took 19.458 microseconds
benchmark took 0.019458 milliseconds
Started of run =>
Speed test
The next tests are runtime compensated for overhead
hrtimeOverhead : 0.00000850540771 s
hrtimeOverhead : 0.00850540771 ms
hrtimeOverhead : 8.50540771 us
hrtimeOverhead : 8505.40771 ns
nop : 0.000030066145000000003 ms
digitalRead : 0.990526 ms
digitalWrite : 0.625301875 ms
pinMode : 0.1040031875 ms
multiply volatile byte : 0.000053372084999999996 ms
divide volatile byte : 0.000084959895 ms
multiply volatile integer : 0.0000576839575 ms
divide volatile integer : 0.000142190415 ms
multiply volatile long : 0.00005307218749999999 ms
multiply single float : 0.00005187062499999999 ms
multiply double float : 0.00005294 ms
divide double float : 0.000157255835 ms
random() : 0.0005705647900000001 ms
bitSet() with volatile : 0.00010729801999999999 ms
gmsleep(1) : 2.04154107325 ms
msleep(1) : 1.100040521 ms
msleep(100) : 100.2031421975 ms
delayMicroseconds(1) : 20.566331275000003 us
delayMicroseconds(5) : 18.272696875 us
delayMicroseconds(100) :141.256928125 us
Runtime = 71.811657967 seconds
<= End of run
However, as you can see below, some lines get put together correctly but others get a newline inserted before the second part is sent to the console. I am calling two functions to accomplish this from the benchmark function. One is "prnt" and the other is "prntln". The first does a process.stdout.write(passed_string_value); and the second does a process.stdout.write(passed_string_value + '\n');
benchmark took 19458 nanoseconds
benchmark took 19.458 microseconds
benchmark took 0.019458 milliseconds
Started of run =>
Speed test
The next tests are runtime compensated for overhead
hrtimeOverhead :
0.00000850540771 s
hrtimeOverhead : 0.00850540771 ms
hrtimeOverhead :
8.50540771 us
hrtimeOverhead : 8505.40771 ns
nop :
0.000030066145000000003 ms
digitalRead :
0.990526 ms
digitalWrite :
0.625301875 ms
pinMode :
0.1040031875 ms
multiply volatile byte :
0.000053372084999999996 ms
divide volatile byte :
0.000084959895 ms
multiply volatile integer :
0.0000576839575 ms
divide volatile integer :
0.000142190415 ms
multiply volatile long :
0.00005307218749999999 ms
multiply single float :
0.00005187062499999999 ms
multiply double float :
0.00005294 ms
divide double float :
0.000157255835 ms
random() :
0.0005705647900000001 ms
bitSet() with volatile :
0.00010729801999999999 ms
gmsleep(1) :
2.04154107325 ms
msleep(1) :
1.100040521 ms
msleep(100) :
100.2031421975 ms
delayMicroseconds(1) :
20.566331275000003 us
delayMicroseconds(5) :
18.272696875 us
delayMicroseconds(100) :
141.256928125 us
Runtime = 71.811657967 seconds
<= End of run
Am I doing something wrong or is there a bug or a buffer race condition I am not taking into account? Thanks for any insight you can give me,
=Gerrry=
The text was updated successfully, but these errors were encountered:
Hi,
I posted this on Google Group but it may be a bug so I am posting it again here,
=Gerry=
Hi,
I am trying to use process.stdout.write to put a line to the console without generating a newline from Cloud9 on a Beaglebone Black. The reason I am doing this is that I am running a series of benchmarks and I want to put out a message ("benchmark #1 : ") to the console when I enter the benchmark function and then at the end of the benchmark function put out the number of milliseconds it took with the unit of measure ('235 ms\n') so that if I look at the console while I am running a series of benchmarks it would look like this:
benchmark took 19458 nanoseconds
benchmark took 19.458 microseconds
benchmark took 0.019458 milliseconds
Started of run =>
Speed test
The next tests are runtime compensated for overhead
hrtimeOverhead : 0.00000850540771 s
hrtimeOverhead : 0.00850540771 ms
hrtimeOverhead : 8.50540771 us
hrtimeOverhead : 8505.40771 ns
nop : 0.000030066145000000003 ms
digitalRead : 0.990526 ms
digitalWrite : 0.625301875 ms
pinMode : 0.1040031875 ms
multiply volatile byte : 0.000053372084999999996 ms
divide volatile byte : 0.000084959895 ms
multiply volatile integer : 0.0000576839575 ms
divide volatile integer : 0.000142190415 ms
multiply volatile long : 0.00005307218749999999 ms
multiply single float : 0.00005187062499999999 ms
multiply double float : 0.00005294 ms
divide double float : 0.000157255835 ms
random() : 0.0005705647900000001 ms
bitSet() with volatile : 0.00010729801999999999 ms
gmsleep(1) : 2.04154107325 ms
msleep(1) : 1.100040521 ms
msleep(100) : 100.2031421975 ms
delayMicroseconds(1) : 20.566331275000003 us
delayMicroseconds(5) : 18.272696875 us
delayMicroseconds(100) :141.256928125 us
Runtime = 71.811657967 seconds
<= End of run
However, as you can see below, some lines get put together correctly but others get a newline inserted before the second part is sent to the console. I am calling two functions to accomplish this from the benchmark function. One is "prnt" and the other is "prntln". The first does a process.stdout.write(passed_string_value); and the second does a process.stdout.write(passed_string_value + '\n');
benchmark took 19458 nanoseconds
benchmark took 19.458 microseconds
benchmark took 0.019458 milliseconds
Started of run =>
Speed test
The next tests are runtime compensated for overhead
hrtimeOverhead :
0.00000850540771 s
hrtimeOverhead : 0.00850540771 ms
hrtimeOverhead :
8.50540771 us
hrtimeOverhead : 8505.40771 ns
nop :
0.000030066145000000003 ms
digitalRead :
0.990526 ms
digitalWrite :
0.625301875 ms
pinMode :
0.1040031875 ms
multiply volatile byte :
0.000053372084999999996 ms
divide volatile byte :
0.000084959895 ms
multiply volatile integer :
0.0000576839575 ms
divide volatile integer :
0.000142190415 ms
multiply volatile long :
0.00005307218749999999 ms
multiply single float :
0.00005187062499999999 ms
multiply double float :
0.00005294 ms
divide double float :
0.000157255835 ms
random() :
0.0005705647900000001 ms
bitSet() with volatile :
0.00010729801999999999 ms
gmsleep(1) :
2.04154107325 ms
msleep(1) :
1.100040521 ms
msleep(100) :
100.2031421975 ms
delayMicroseconds(1) :
20.566331275000003 us
delayMicroseconds(5) :
18.272696875 us
delayMicroseconds(100) :
141.256928125 us
Runtime = 71.811657967 seconds
<= End of run
Am I doing something wrong or is there a bug or a buffer race condition I am not taking into account? Thanks for any insight you can give me,
=Gerrry=
The text was updated successfully, but these errors were encountered: