Co-authored-by: Marius A. Aardal <marius.andre.aardal@gmail.com> Co-authored-by: Gora Adj <gora.adj@tii.ae> Co-authored-by: Diego F. Aranha <dfaranha@cs.au.dk> Co-authored-by: Andrea Basso <sqisign@andreabasso.com> Co-authored-by: Isaac Andrés Canales Martínez <icanalesm0500@gmail.com> Co-authored-by: Jorge Chávez-Saab <jorgechavezsaab@gmail.com> Co-authored-by: Maria Corte-Real Santos <mariascrsantos98@gmail.com> Co-authored-by: Luca De Feo <github@defeo.lu> Co-authored-by: Max Duparc <max.duparc@epfl.ch> Co-authored-by: Jonathan Komada Eriksen <jonathan.eriksen97@gmail.com> Co-authored-by: Décio Luiz Gazzoni Filho <decio@decpp.net> Co-authored-by: Basil Hess <bhe@zurich.ibm.com> Co-authored-by: Antonin Leroux <antonin.leroux@polytechnique.org> Co-authored-by: Patrick Longa <plonga@microsoft.com> Co-authored-by: Luciano Maino <mainoluciano.96@gmail.com> Co-authored-by: Michael Meyer <michael@random-oracles.org> Co-authored-by: Hiroshi Onuki <onuki@mist.i.u-tokyo.ac.jp> Co-authored-by: Lorenz Panny <lorenz@yx7.cc> Co-authored-by: Giacomo Pope <giacomopope@gmail.com> Co-authored-by: Krijn Reijnders <reijnderskrijn@gmail.com> Co-authored-by: Damien Robert <damien.robert@inria.fr> Co-authored-by: Francisco Rodríguez-Henriquez <francisco.rodriguez@tii.ae> Co-authored-by: Sina Schaeffler <sschaeffle@student.ethz.ch> Co-authored-by: Benjamin Wesolowski <benjamin.wesolowski@ens-lyon.fr>
76 lines
1.3 KiB
C
76 lines
1.3 KiB
C
#include <stdio.h>
|
|
#include <time.h>
|
|
|
|
static clock_t global_timer;
|
|
|
|
clock_t
|
|
tic(void)
|
|
{
|
|
global_timer = clock();
|
|
return global_timer;
|
|
}
|
|
|
|
float
|
|
tac(void)
|
|
{
|
|
float ms = (1000. * (float)(clock() - global_timer) / CLOCKS_PER_SEC);
|
|
return ms;
|
|
}
|
|
|
|
float
|
|
TAC(const char *str)
|
|
{
|
|
float ms = (1000. * (float)(clock() - global_timer) / CLOCKS_PER_SEC);
|
|
#ifndef NDEBUG
|
|
printf("%s [%d ms]\n", str, (int)ms);
|
|
#endif
|
|
return ms;
|
|
}
|
|
|
|
float
|
|
toc(const clock_t t)
|
|
{
|
|
float ms = (1000. * (float)(clock() - t) / CLOCKS_PER_SEC);
|
|
return ms;
|
|
}
|
|
|
|
float
|
|
TOC(const clock_t t, const char *str)
|
|
{
|
|
float ms = (1000. * (float)(clock() - t) / CLOCKS_PER_SEC);
|
|
printf("%s [%d ms]\n", str, (int)ms);
|
|
return ms;
|
|
// printf("%s [%ld]\n",str,clock()-t);
|
|
// return (float) (clock()-t);
|
|
}
|
|
|
|
float
|
|
TOC_clock(const clock_t t, const char *str)
|
|
{
|
|
printf("%s [%ld]\n", str, clock() - t);
|
|
return (float)(clock() - t);
|
|
}
|
|
|
|
clock_t
|
|
dclock(const clock_t t)
|
|
{
|
|
return (clock() - t);
|
|
}
|
|
|
|
float
|
|
clock_to_time(const clock_t t, const char *str)
|
|
{
|
|
float ms = (1000. * (float)(t) / CLOCKS_PER_SEC);
|
|
printf("%s [%d ms]\n", str, (int)ms);
|
|
return ms;
|
|
// printf("%s [%ld]\n",str,t);
|
|
// return (float) (t);
|
|
}
|
|
|
|
float
|
|
clock_print(const clock_t t, const char *str)
|
|
{
|
|
printf("%s [%ld]\n", str, t);
|
|
return (float)(t);
|
|
}
|