fiddler overall elapsed time units - fiddler

In Fiddler, what's the units on the Overall Elapsed time? Is this 0.904s?

Related

Is there a way to do a millisecond level delay in matlab?

Help for 'PAUSE' says
PAUSE(n) pauses for n seconds before continuing, where n can also be a
fraction. The resolution of the clock is platform specific. Fractional
pauses of 0.01 seconds should be supported on most platforms.
But in my case pause(0.01) doesn't do anything at all (pause, pause(n) with whole number n works)
Is there any way to make a millisecond level delay (50 ms, 100 ~ 500 ms) delay in matlab?
Matlab version is
MATLAB Version 7.9.0.529 (R2009b)
64 bit on a Windows 10 64 bit Home edition
I see two options. Let's call them the looping option and the native option. The first is just using a while loop to check if your desired time to wait is already reached. You can do this with MATLAB's stopwatch timer tic and toc. This is the normal time (not the CPU-time). As you are writing a loop, which runs at maximum speed, you might encounter a high CPU-usage but this should be OK if it is only for a couple of milliseconds.
%% looping
% desired time to wait
dt_des = 0.001; % 1 ms
% initialize clock
t_st = tic;
% looping
while toc(t_st) < dt_des
end
% read clock
toc(t_st)
The native option is using pause (make sure that you have enabled it once with pause('on')). I assumed from your question that this does not always work -- however, it does on my system (R2019b, windows 10).
%% use pause()
tic
pause(0.001)
toc
The results of both are
Elapsed time is 0.001055 seconds.
Elapsed time is 0.001197 seconds.
It's not too accurate but you might get better results if you tune the numbers on your PC.
you can also use
java.lang.Thread.sleep(10);
if you are using an old matlab version, see discussion here.

Unix time but with leap seconds

Unix time is useful for measuring time, whereas other formats are more useful for telling the time.
This is because (apart from time synchronization), it just ticks forward one second at a time.
It doesn't change when our clock for telling the time has an hour change, for example.
However, there does seem to be one exception. It ignores leap seconds, meaning when there is a leap second, it basically jumps back a second.
I'm wondering is there a similar format to Unix time that also includes leap seconds and has no special cases at all?
Nevermind, unix time has no exception for leap seconds.
I believe the explanation for unix time on Wikipedia is awful:
It is the number of seconds that have elapsed since the Unix epoch, minus leap seconds
This is incorrect, it should be:
It is the number of clock / artificial Earth seconds that have elapsed since the Unix epoch, minus leap seconds
Or in simpler terms:
It is the numbers of measured seconds that have elapsed since the Unix epoch
Hope this solves anyone else's confusion.

How to stop fmincon after running an elapsed time of T sec?

I am running fmincon for a gird. For some points in the grid there is no solution, exit flag=-2, and it takes half an hour sometimes to return the flag and start the next point in the grid. However, for the other points the answer is revealed in less than a min.
So I thought one possible solution to reduce the unnecessary running time is to define a stop criteria based on elapsed time for each point in the grid. In other words, How to stop fmincon after running an elapsed time of T sec?
You can use an output function:
tic
fmincon(.....,optimset('OutputFcn',#outfun,'MaxFunEval',20000))
outfun.m :
function stop = outfun(x,optimValues,state)
stop = toc>T;

Calculating turnaround and total wait time for FCFS and SFJ

I was given an assignment in which I have to calculate both the turnaround and total wait time based on:
Process Name: P1 | P2 | P3 |
Time of Arrival: P1=0 P2=2 P3=8
Total execution time: P1=10 P25 P3=27
Time needed for IO operations: P1=1.5 P2=2 P3=1.1
IO operations waiting and processing time: P1=5 P2=5 P3=3.5
Priority: P1=2 P2=1 P3=4
I found some info online saying that the turnaround time can be calculated by turnaround = total execution time - time of arrival and the total wait time can be calculated using total wait time = turnaround time - total execution time when you're only given the arrival time and the total execution time (CPU burst I think?).
How would the formulas above look like in this case since I have some extra info like the time needed for IO operations and IO operations waiting and processing time?

Measure CPU time usage in Matlab (in milliseconds)

How can I measure the time used by Matlab in the execution of some commands? I am looking for something like linux time command, which returns the actual CPU used (user + sys), instead of the total time transcurred, which can vary depending on system usage by other processes.
Also, the time should be returned in milliseconds.
You can use cputime:
CPUTIME CPU time in seconds.
CPUTIME returns the CPU time in seconds that has been used
by the MATLAB process since MATLAB started.
For example:
t=cputime; your_operation; cputime-t
returns the cpu time used to run your_operation.
The return value may overflow the internal representation
and wrap around.
There's also timeit.
And you can also use tic/ toc (see Daniel's answer).
See some useful comments on measuring CPU time. According to the above link, tic / toc and timeit give more accurate estimations than cputime.
For a simple clock time solution, use tic and toc
profile provides a detailed report code per line, you can choose between cpu time and real time.