Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Elaspe time calculation

1 REPLY 1
Reply
Message 1 of 2
Anonymous
151 Views, 1 Reply

Elaspe time calculation

For those that care , here is a C++ code snippet to show
how to use the high performce timers built into the computers
(if available). If the timers are not availble then use the standard
lower resolution timer.

Later,
Paul Kohut

#include "time.h"
.
.
.
// Perform timings using the built in high frequency timers, if available
LARGE_INTEGER lfreq;
if(QueryPerformanceFrequency(&lfreq)) {
acutPrintf("\nTimings performed by high frequency counter.");
LARGE_INTEGER lstart, lfinish;
double ldiff;
if(nLength) {
QueryPerformanceCounter(&lstart);
// begin timed process
if(GetLayerList(&idArray, nLength, ss)) {
QueryPerformanceCounter(&lfinish);
ldiff = lfinish.QuadPart - lstart.QuadPart;
acutPrintf("\n%.8f seconds to process %i entities and %i layers",
ldiff / lfreq.QuadPart, nLength, idArray.length());


QueryPerformanceCounter(&lstart);
// begin timed process
if(LayersOff(&idArray)) {
QueryPerformanceCounter(&lfinish);
ldiff = lfinish.QuadPart - lstart.QuadPart;
acutPrintf("\n%.8f seconds to turn off %i layers", ldiff /
lfreq.QuadPart, idArray.length());
}
}
}
}
else { // No high frequency timers available.
// Perform timing with stanard resolution of GetTickCount, see
documentation
DWORD start, finish;
acutPrintf("\nTimings performed by GetTickCount, see documentation for
frequency.");
start = GetTickCount();
if(GetLayerList(&idArray, nLength, ss)) {
finish = GetTickCount();
acutPrintf("\n%.8f seconds to process %i entities and %i layers",
0.001 * (finish - start), nLength, idArray.length());
start = GetTickCount();
if(LayersOff(&idArray)) {
finish = GetTickCount();
acutPrintf("\n%.8f seconds to turn off %i layers", 0.001 * (finish -
start), idArray.length());
}
}
}
1 REPLY 1
Message 2 of 2
vnestr
in reply to: Anonymous

Thanks a lot, Paul!

Vlad.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost