[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #55940] pause() takes too long if you call it
From: |
Andrew Janke |
Subject: |
[Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch |
Date: |
Mon, 18 Mar 2019 13:20:52 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36 |
Follow-up Comment #15, bug #55940 (project octave):
Test program:
#include <time.h>
#include <stdio.h>
#include <ctime>
#include <chrono>
extern "C"
int main (int argc, char *argv[]) {
using namespace std::chrono;
int n = 100;
int delay = 200;
time_t tv_sec = 0;
long tv_nsec = delay * 1000000;
struct timespec delay_timespec;
delay_timespec.tv_sec = tv_sec;
delay_timespec.tv_nsec = tv_nsec;
struct timespec rem;
for (int i = 0; i < n; i++) {
high_resolution_clock::time_point t0 =
high_resolution_clock::now();
nanosleep (&delay_timespec, &rem);
high_resolution_clock::time_point t1 =
high_resolution_clock::now();
duration<double> time_span = duration_cast<duration<double>
>(t1 - t0);
printf ("Step %4d: elapsed = %f\n", i, time_span.count());
}
}
Results:
$ ./a.out
Step 0: elapsed = 0.202791
Step 1: elapsed = 0.201132
Step 2: elapsed = 0.200450
Step 3: elapsed = 0.200035
Step 4: elapsed = 0.201446
Step 5: elapsed = 0.200258
Step 6: elapsed = 0.200578
Step 7: elapsed = 0.200934
[...]
It's within a few milliseconds of 200 ms each time I run it.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55940>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, (continued)
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, John W. Eaton, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Mike Miller, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch,
Andrew Janke <=
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Mike Miller, 2019/03/18
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Andrew Janke, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Dmitri A. Sergatskov, 2019/03/19
- [Octave-bug-tracker] [bug #55940] pause() takes too long if you call it a bunch, Rik, 2019/03/19