timing

Specific Path Algorithm with Speed Considered

I need to create an algorithm where a "vehicle" covers a 1262 m x 1262 m area with 20% overlap between each "leg". The width of each leg is 103 m, which by my calculations gives 16 "legs" needed to cover this area. At the end of each leg, the vehicle does a 180 degree turn, and completes the next search leg. The vehicle is traveling a...

C# sub millisecond timing

Is there anywhere in C# to perform timing operations with sub millisecond accuracy? I'm putting timing code in my software and everything is being returned as 0ms. I would like to know if there is a way of getting even finer granularity. Addendum: is this the correct code to get sub millisecond timing? timeSpan.TotalMilliseconds / 10...

What is the best way to time how long functions take in C++?

In C# I would fire up the Stopwatch class to do some quick-and-dirty timing of how long certain methods take. What is the equivalent of this in C++? Is there a high precision timer built in? ...

Timing a method and threads in .NET

I have two threads in my app - the main UI thread and another thread initiated by the wm_WiiMoteChanged event handler (a background thread). In the main thread I do some video processing. I have a function called processFrame shown below. I use that code to measure the time to process each frame and thus the frames per second rate. If I...

Visual Studio 2008 profiler analysis - missing time

I ran the Visual Studio 2008 profiler against my ASP.NET application and came up with the following result set. CURRENT FUNCTION TIME (msec) ---------------------------------------------------|-------------- Data.GetItem(params) | 10,158.12 ----------------------------...

Windows serial port timing?

I need to measure the time between character events on a serial port, preferably under Windows 7. I have read in various places, statements like "Windows will not provide greater resolution than 10ms", but I have not been able to find out what that really means. Is the problem that the OS will not deliver the events with greater accuracy...

Schedule a repeating event in Python 3

I'm trying to schedule a repeating event to run every minute in Python 3. I've seen class sched.scheduler but I'm wondering if there's another way to do it. I've heard mentions I could use multiple threads for this, which I wouldn't mind doing. I'm basically requesting some JSON and then parsing it; its value changes over time. To use...

WPF: Controlling timing of media

Does anyone have a sample on how to control timing of a audio clip in wpf c# I'm using this code to control timing of a animated disappearing of a image. DoubleAnimation AnimImage3Ut = new DoubleAnimation(); AnimImage3Ut.From = 1; AnimImage3Ut.To = 0; AnimImage3Ut.BeginTime = (TimeSpan.FromSeconds(12.0)); AnimImage...

Java3D getting time problem

Hi, I made a little Shooter game with two ships firing at each other. I used methods of paintComponent for drawing or moving object, but for some reason it ran at a different speed on each computer. I searched for a solution and made some modifications to my game like drawing and moving objects in thread. Now it runs at the same speed ...

C# - Repeating a method call using timers

In a VSTO add-in I'm developing, I need to execute a method with a specific delay. The tricky part is that the method may take anywhere from 0.1 sec to 1 sec to execute. I'm currently using a System.Timers.Timer like this: private Timer tmrRecalc = new Timer(); // tmrRecalc.Interval = 500 milliseconds private void tmrRecal...

Measuring execution time of a call to system() in C++

I have found some code on measuring execution time here http://www.dreamincode.net/forums/index.php?showtopic=24685 However, it does not seem to work for calls to system(). I imagine this is because the execution jumps out of the current process. clock_t begin=clock(); system(something); clock_t end=clock(); cout<<"Execution time: "<...

Timing portions of a PHP script, including runtime of individual methods of objects?

I was looking for a reliable, clean way to do advanced runtime reports for specific portions of a PHP script. What I'd love to do is dynamically time and track every method call of every object during script execution, log this information, and create a table/report at the end of the script for output. I've thought about doing something...

How long does each test take to run in Ruby on Rails?

Is there a way to get a report of how long each test is taking to run on a Ruby on Rails project? I have a a small set of tests, 2 or 3, which take about 50% of the time and I'd like to find out which ones are. ...

Game loop and time tracking

Maybe I'm just an idiot, but I've been trying to implement a game loop all day and it's just not clicking. I've read literally every article I could find on Google, but the problem is that they all use different timing mechanisms, which makes them difficult to apply to my particular situation (some use milliseconds, other use ticks, etc)...

Getting timing consistency in Linux

I can't seem to get a simple program (with lots of memory access) to achieve consistent timing in Linux. I'm using a 2.6 kernel, and the program is being run on a dual-core processor with realtime priority. I'm trying to disable cache effects by declaring the memory arrays as volatile. Below are the results and the program. What are some...

Python Animation Timing

I'm currently working on sprite sheet tool in python that exports the organization into an xml document but I've run into some problems trying to animate a preview. I'm not quite sure how to time the frame rate with python. For example, assuming I have all of my appropriate frame data and drawing functions, how would I go about coding th...

differences between "d.clear()" and "d={}"

On my machine, the execution speed between d.clear() and d={} is over 100ns so am curious why one would use one over the other. import timeit def timing(): d = dict() if __name__=='__main__': t = timeit.Timer('timing()', 'from __main__ import timing') print t.repeat() ...

differences between "d = dict()" and "d = {}"

Why would one use one over the other: d = dict() ~0.208 usec d = {} ~0.06 usec ...

delay loop output in C++

I have a while loop that runs in a do while loop. I need the while loop to run exactly every second no faster no slower. but i'm not sure how i would do that. this is the loop, off in its own function. I have heard of the sleep() function but I also have heard that it is not very accurate. int min5() { int second = 00; int minut...

Why are gettimeofday() intervals occasionally negative?

I have an experimental library whose performance I'm trying to measure. To do this, I've written the following: struct timeval begin; gettimeofday(&begin, NULL); { // Experiment! } struct timeval end; gettimeofday(&end, NULL); // Print the time it took! std::cout << "Time: " << 100000 * (end.tv_sec - begin.tv_sec) + (end.tv_usec - ...