SORU
20 Ocak 2009, Salı


C En İyi zamanlama yöntemi?

Yüksek çözünürlük ve taşınabilirlik ile bir kod bölümü zaman için en iyi yolu nedir?

/* Time from here */
ProcessIntenseFunction();
/* to here. */

printf("Time taken %d seconds %d milliseconds", sec, msec);

Çapraz platform bir çözüm olurdu standart bir kütüphane var mı?

CEVAP
20 Ocak 2009, Salı


Bu çalışması gerektiğini düşünüyorum:

#include <time.h>

clock_t start = clock(), diff;
ProcessIntenseFunction();
diff = clock() - start;

int msec = diff * 1000 / CLOCKS_PER_SEC;
printf("Time taken %d seconds %d milliseconds", msec/1000, msec00);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • How To Cook That

    How To Cook

    16 NİSAN 2011
  • KoreanFrogMania님의 채널

    KoreanFrogMa

    18 Aralık 2011
  • Vintendo Power

    Vintendo Pow

    2 Ocak 2007