timing

Is there any library for C# providing a thread pool that will execute no more than X tasks per unit of time?

A problem is that a particular resource cannot handle more than 1 request per second and I want to pass that parameter to a thread pool that manages all concurrent calls to that resource. Is there any library that offers such kind of custom thread pool or I should look forward to implement my own? Thanks. ...

Is there any way I can see how long a JQuery AJAX call takes to execute?

Hi folks, Is there anyway to see how long a simple $.getJSON method takes to call using some type of timing code, in jquery/javascript? Secondly, is there any way to see how BIG the response Content-Length is, in kB or megabytes? ...

Where does wireshark get its microsecond timers from

Wireshark times events down to microseconds and appears to do so with great accuracy. My question is where in the world do those timers come from when running under windows? If the answer is "it uses thus and such library" then my question is "well, where does that library get its timers under windows"? ...

Why does mysql_query() sometimes require 0.1 of a second on a query that executes fast

I’ve noticed that sometimes mysql_query() on particular query in my script executes immediately and sometimes it takes (almost exactly) 0.1 of a second. I wrote a simple script to test it: mysql_connect('<server>','<login>','<pass>'); mysql_select_db('<db>'); print microtime(true).'<br />'; mysql_query("select * from `messages` where `...

Is setTimeout with no delay the same as executing the function instantly?

I am looking at some existing code in a web application. I saw this: window.setTimeout(function () { ... }) Is this the same as just executing the function content right away? ...

How do I measure how long a (linux C) function takes to execute?

I have a particular function (well, set of functions) that I want to start every 400ms. I'm not much of a C programmer, and so anything outside of the standard libraries is a mystery to me, as well as quite a bit within them. My first thought is to use nanosleep to pause execution for 400ms in some sort of loop, but this of course doesn...

Timing accuracy in Flash

Does anyone know how accurate flash timing is and its ability to identify the client monitor's refresh rate? I need to be able to calculate time durations with up to 10 milliseconds accuracy of response time. Also if it is off, is there a way to possibly calibrate the response based on monitor refresh rate and action to make sure the v...

Why does my timing code always return 0?

hi guys , i was optimizing my html5 game engine for performance issues and i want to know how much time a render process needs.So i got a bunch of render functions.Each of them render seperated parts of the game.. such as blocks , players etc. function gameRender() { var d1 = new Date(); var firstTime = d1.getTime(); // ren...

C# System.Diagnostics.Process: how to exit a process if it takes more than, say, 10 seconds?

I tried the following code: p = StartProcess("some_process.exe"); DateTime startTime = DateTime.Now; p.Start(); while (!p.HasExited) { executeTime = (DateTime.Now - startTime).Milliseconds; if (executeTime > 10000) // 10 seconds { Console.Write("Test \"" + inputTest + "\" failed: takes more than 10 seconds"); ...

R - How to 'time' delays as well as user input

What would be a good way to create a timer in R. One that would require little system resources. So far I have a simple delay: t1=as.numeric(format(Sys.time(), "%s")); t2=t1; while (t2-t1<5) t2=as.numeric(format(Sys.time(), "%s")); And the corresponding timer: t1=as.numeric(format(Sys.time(), "%s"));t2=t1; [Event] t2=as.numeric(...

Synchronizing a service with a timer

I'm trying to write a service in c# that should be run on a given interval (a timeout) from a given date. If the date is in the future the service should wait to start until the date time is reached. Example: If I set a timeout to be 1 hour from 21:00:00 I want the program to run every hour If I set a timeout to be 1 hour from 3999....

Peculiar result relating to struct size and performance

I was curious on the overhead of a large structure vs. a small structure in using operators + and * for math. So I made two struct, one Small with 1 double field (8 bytes) and one Big with 10 doubles (80 bytes). In all my operations I only manipulate one field called x. First I defined in both structures mathematical operators like pub...

sysopen permission denied

I'm trying to fix an intermittent bug in git-svn. The problem is happening in Windows XP only, with both Cygwin git (perl v5.10.1) and msysGit (perl v5.8.8). With any operation that involves a fetch, I'm able to get partway through and then the operation dies with a message similar to Couldn't open .git/svn/refs/remotes/trunk/.rev_...

winapi threads take time to initialise before message passing works?

I have a main program that creates the threads in order: ThreadB then ThreadA (which is passed ThreadB's ID) using the CreateThread function. Thread A sends a message to Thread B using PostThreadMessage. B gets the message using GetMessage. The problem I am having is that PostThreadMessage blocks randomly the first time it is called an...

slow down gdb to reproduce bug

Hi, I have a timing bug in my application which only occurs when I use valgrind, because valgrind slows down the process so much. (it's actually a boost::weak_ptr-exception that I cannot localize) Now I wonder how to reproduce the bug with gdb. I don't see a way to combine gdb + valgrind. Thanks. ...

When/where to startUpdatingLocation?

The determination of a position takes some time. When and where should the location manager be started? Now I'm starting the location update one view before the result view (which needs the location) is loaded. If the user taps to fast I get 0.0 coordinates. To get the right timing the startUpdatingLocation should be called three views...

Measuring time taken by a function: clock_gettime

Hi, I am trying to measure how long a function takes. I have a little issue: although I am trying to be precise, and use floating points, every time I print my code using %lf I get one of two answers: 1.000... or 0.000.... This leads me to wonder if my code is correct: #define BILLION 1000000000L; // Calculate time taken by a reques...

Is the request timing information in rails accurate?

In a rails (2.3.8) app, my server log in development mode shows lines like these: Completed in 265ms (View: 212, DB: 8) What accounts for the missing 45ms? Even when repeating a request that does hardly anything, the timing information often reads: Completed in 14ms (View: 1, DB: 1) Is the remaining time anything to do with framew...

Measuring total CPU time of a program that uses precompiled libraries (C++, Linux)

Hi everyone, I am currently stumbled into this problem and I'd love to hear some suggestions from you. I have a C++ program that uses a precompiled library to make some queries to PostgreSQL database. Now the problem is I want to find out the total (combined) cpu time it takes to do all routines described in the source code of the prog...

Algorithm for piecing together a sequence from multiple fragments

I am working on a real-time embedded system. I am trying to create a detailed timing analysis. I have collected runtime data, recording the start and stop time of each interrupt. Each burst of data looks something like this ISR# time ----- ---- 1 34 end 44 4 74 3 80 end 93 end 97 ... My output c...