Instrumented Nasal GC

This commit is contained in:
Richard Harrison
2019-05-07 05:17:27 +02:00
parent 39eb9837e9
commit c06eabff24
5 changed files with 66 additions and 11 deletions
+18
View File
@@ -337,3 +337,21 @@ int SGTimeStamp::elapsedMSec() const
return static_cast<int>((now - *this).toMSecs());
}
int SGTimeStamp::elapsedUSec() const
{
SGTimeStamp now;
now.stamp();
return static_cast<int>((now - *this).toUSecs());
}
extern "C" {
SGTimeStamp global_timestamp;
void global_stamp() {
global_timestamp.stamp();
}
extern int global_elapsedUSec()
{
return global_timestamp.elapsedUSec();
}
}
+6 -2
View File
@@ -221,9 +221,13 @@ public:
{ return sleepFor(fromMSec(msec)); }
/**
* elapsed time since the stamp was taken, in msec
*/
* elapsed time since the stamp was taken, in msec
*/
int elapsedMSec() const;
/**
* elapsed time since the stamp was taken, in usec
*/
int elapsedUSec() const;
private:
SGTimeStamp(sec_type sec, nsec_type nsec)
{ setTime(sec, nsec); }