Mierzenie czasu procesu

0

Witam. Chciałem do zmierzenia czasu użyć funkcji gettime, jednak podczas kompilacji wyskakują mi takie errory:

zad1.c:(.text+0x15): undefined reference to clock_gettime' zad1.c:(.text+0x93): undefined reference to clock_gettime'

Przykładowy sStart i stop:

	struct timespec start, stop;

   	if( clock_gettime( CLOCK_REALTIME, &start) == -1 ) {
      		perror( "clock gettime" );
      		exit( EXIT_FAILURE );
    	}
	if( clock_gettime( CLOCK_REALTIME, &stop) == -1 ) {
      		perror( "clock gettime" );
      		exit( EXIT_FAILURE );
    	}
0
#include <time.h>
0

Był zaincludowany time.h.

0

man:

Most systems require the program be linked with the librt library to use these functions.

Dodaj w kompilacji -lrt.

0

Dzięki z lrt przeszło. Ale po uruchomieniu wyskakuje brak dostępu. Nie wiem czemu.

1 użytkowników online, w tym zalogowanych: 0, gości: 1