version 0.5.0_alpha
git-svn-id: svn://db.shs.com.ru/pip@8 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
System tests program
|
||||
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
|
||||
Copyright (C) 2015 Ivan Pelipenko peri4ko@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
#ifdef WINDOWS
|
||||
cout << "This program is useless for Windows" << endl;
|
||||
#if defined(WINDOWS) || defined(MAC_OS)
|
||||
piCout << "This program is useless for Windows";
|
||||
return 0;
|
||||
#else
|
||||
if (getuid() != 0) {
|
||||
cout << "You should run this program as root!" << endl;
|
||||
piCout << "You should run this program as root!";
|
||||
return 0;
|
||||
}
|
||||
PIConfig conf(
|
||||
@@ -45,9 +45,9 @@ int main(int argc, char * argv[]) {
|
||||
clock_getres(CLOCK_REALTIME, &ts);
|
||||
stc = long(ts.tv_sec) * 1000000000l + long(ts.tv_nsec);
|
||||
conf.setValue("time_resolution_ns", stc);
|
||||
cout << "Timer resolution is " << stc << " ns" << endl;
|
||||
piCout << "Timer resolution is " << stc << " ns";
|
||||
|
||||
cout << "\"PITimer.elapsed_*\" test ... " << flush;
|
||||
piCout << "\"PITimer.elapsed_*\" test ... ";
|
||||
stc = 0;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 1000;
|
||||
@@ -73,9 +73,9 @@ int main(int argc, char * argv[]) {
|
||||
}
|
||||
sts /= stc;
|
||||
conf.setValue("time_elapsed_ns", long(sts));
|
||||
cout << "ok, cost " << sts << " ns, average in " << stc << " series (" << (stc * 3 * times.size_s()) << " executes)" << endl;
|
||||
piCout << "ok, cost" << sts << "ns, average in" << stc << "series (" << (stc * 3 * times.size_s()) << "executes)";
|
||||
|
||||
cout << "\"usleep\" offset test ... " << flush;
|
||||
piCout << "\"usleep\" offset test ... ";
|
||||
PISystemTests::time_elapsed_ns = sts;
|
||||
tm.reset();
|
||||
stc = 0;
|
||||
@@ -98,7 +98,7 @@ int main(int argc, char * argv[]) {
|
||||
}
|
||||
sts /= stc;
|
||||
conf.setValue("usleep_offset_us", long(sts));
|
||||
cout << "ok, " << sts << " us, average in " << stc << " series (" << (stc * times.size_s()) << " executes)" << endl;
|
||||
piCout << "ok," << sts << "us, average in" << stc << "series (" << (stc * times.size_s()) << "executes)";
|
||||
|
||||
//WAIT_FOR_EXIT
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user