Skip to content

Instantly share code, notes, and snippets.

@3runo5ouza
Created April 9, 2013 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3runo5ouza/5344794 to your computer and use it in GitHub Desktop.
Save 3runo5ouza/5344794 to your computer and use it in GitHub Desktop.
Para verificar o tempo de execução de um programa ou uma parte de um programa.
//BIBLIOTECA
#include <time.h>
//VARIAVEIS
clock_t inicio, fim;
double tempoGasto;
//ANTES DO PROCESSO
inicio = clock();
//o processo q se quer medir fica aqui
//DEPOIS DO PROCESSO
fim = clock();
tempoGasto = (double)(fim - inicio) / CLOCKS_PER_SEC;
//MOSTRA
printf("\nTempo de execucao: %f", tempoGasto);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment