I was finding things were running slow with a NXT PC API program and by profiling I boiled down the problem to getTachoCount() on RemoteMotor. I am using v091 snapshot.
- Code: Select all
RemoteMotor m = Motor.B;
float volts = Battery.getVoltage();
System.out.println("+++ volts " + volts);
long mark = System.currentTimeMillis();
int tc = m.getTachoCount();
System.out.println("--- " + (System.currentTimeMillis() - mark));
System.out.println("+++ TC " + tc);
BlueCove version 2.1.0 on winsock
+++ volts 8.405
+++ TC 0
From the above code and output a couple of questions:
- why is getTachoCount taking around 40 ms?
- if I remove Battery.getVoltage() why does getTachoCount taking around 350 ms?