omp_get_wtime

Restituisce un valore in secondi del tempo trascorso da un certo punto.

double omp_get_wtime( );

Valore restituito

Restituisce un valore in secondi del tempo trascorso da un certo punto arbitrario, ma coerente.

Note

Tale punto rimanga coerente durante l'esecuzione del programma, consentendo i confronti successivi.

Per ulteriori informazioni, vedere Una funzione 3.3.1 omp_get_wtime.

Esempio

// omp_get_wtime.cpp
// compile with: /openmp
#include "omp.h"
#include <stdio.h>
#include <windows.h>

int main() {
    double start = omp_get_wtime( );
    Sleep(1000);
    double end = omp_get_wtime( );
    double wtick = omp_get_wtick( );

    printf_s("start = %.16g\nend = %.16g\ndiff = %.16g\n",
             start, end, end - start);

    printf_s("wtick = %.16g\n1/wtick = %.16g\n",
             wtick, 1.0 / wtick);
}
  

Vedere anche

Concetti

Funzioni di OpenMP