|
From: Dan M. <dan...@gm...> - 2007-04-09 19:17:33
|
worked just fine! thank you very much Stephan!
Cheers!
Dan
On 4/6/07, Stephan Meyer <ste...@we...> wrote:
>
>
> I use QueryPerformanceCounter() and QueryPerformanceFrequency() for this.
>
> Here's some sample code:
>
> #include <windows.h>
> #include <stdint.h>
> #include <stdio.h>
>
> uint64_t _start, _stop, _freq;
> void timer_init(void);
> void timer_start(void);
> void timer_stop(void);
> double timer_get_time(void);
>
> void timer_init(void)
> {
> LARGE_INTEGER f;
> QueryPerformanceFrequency(&f);
> _freq = (uint64_t)f.QuadPart;
> }
>
> void timer_start(void)
> {
> LARGE_INTEGER t;
> QueryPerformanceCounter(&t);
> _start = (uint64_t)t.QuadPart;
> }
>
> void timer_stop(void)
> {
> LARGE_INTEGER t;
> QueryPerformanceCounter(&t);
> _stop = (uint64_t)t.QuadPart;
> }
>
> double timer_get_time(void)
> {
> return ((double)(_stop - _start)) / _freq;
> }
>
> int main(void)
> {
> timer_init();
>
> timer_start();
> // do something
> timer_stop();
> printf("time elapsed: %fs\n", timer_get_time());
>
> timer_start();
> // do something
> timer_stop();
> printf("time elapsed: %fs\n", timer_get_time());
>
> return 0;
> }
>
>
> > Hi there,
> >
> >
> >
> > I'm trying to calculate the time it takes to write and read data to/from
> the device. But the maximum packet size I can use is 2048 and it writes too
> fast. So fast that I'm unable to measure how long it took. Does anyone have
> an idea on how I could calculate writing and reading rate? thanks is
> advance.
> >
> >
> >
> > Dan
> >
> > -----------------------------------------------------------------
> >
> -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys-and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > -----------------------------------------------------------------
> > _______________________________________________
> > Libusb-win32-devel mailing list
> > Lib...@li...
> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
> >
>
>
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Libusb-win32-devel mailing list
> Lib...@li...
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>
|