|
PAPI
5.0.1.0
|

Go to the source code of this file.
Functions | |
| long long | _linux_get_real_cycles (void) |
| long long | _linux_get_virt_usec_pttimer (void) |
| long long | _linux_get_virt_usec_gettime (void) |
| long long | _linux_get_virt_usec_times (void) |
| long long | _linux_get_virt_usec_rusages (void) |
| long long | _linux_get_real_usec_gettime (void) |
| long long | _linux_get_real_usec_gettimeofday (void) |
| long long | _linux_get_real_usec_cycles (void) |
| long long | _linux_get_real_nsec_gettime (void) |
| long long | _linux_get_virt_nsec_gettime (void) |
| int | mmtimer_setup (void) |
| int | init_proc_thread_timer (hwd_context_t *thr_ctx) |
| long long _linux_get_real_cycles | ( | void | ) |
Definition at line 243 of file linux-timer.c.
{
long long retval;
#if defined(HAVE_GETTIMEOFDAY)||defined(__powerpc__)||defined(__arm__)||defined(__mips__)
/* Crude estimate, not accurate in prescence of DVFS */
retval = _papi_os_vector.get_real_usec( ) *
( long long ) _papi_hwi_system_info.hw_info.cpu_max_mhz;
#else
retval = get_cycles( );
#endif
return retval;
}
| long long _linux_get_real_nsec_gettime | ( | void | ) |
Definition at line 463 of file linux-timer.c.
{
long long retval;
struct timespec foo;
#ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
#else
syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
#endif
retval = ( long long ) foo.tv_sec * ( long long ) 1000000000;
retval += ( long long ) ( foo.tv_nsec );
return retval;
}
| long long _linux_get_real_usec_cycles | ( | void | ) |
Definition at line 308 of file linux-timer.c.
{
long long retval;
/* Not accurate in the prescence of DVFS */
retval = get_cycles( ) /
( long long ) _papi_hwi_system_info.hw_info.cpu_max_mhz;
return retval;
}
| long long _linux_get_real_usec_gettime | ( | void | ) |
Definition at line 271 of file linux-timer.c.
{
long long retval;
struct timespec foo;
#ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
#else
syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
#endif
retval = ( long long ) foo.tv_sec * ( long long ) 1000000;
retval += ( long long ) ( foo.tv_nsec / 1000 );
return retval;
}
| long long _linux_get_real_usec_gettimeofday | ( | void | ) |
| long long _linux_get_virt_nsec_gettime | ( | void | ) |
Definition at line 486 of file linux-timer.c.
| long long _linux_get_virt_usec_gettime | ( | void | ) |
Definition at line 374 of file linux-timer.c.
| long long _linux_get_virt_usec_pttimer | ( | void | ) |
< A System/C library call failed
< A System/C library call failed
< A System/C library call failed
< A System/C library call failed
Definition at line 393 of file linux-timer.c.
{
long long retval;
char buf[LINE_MAX];
long long utime, stime;
int rv, cnt = 0, i = 0;
int stat_fd;
again:
sprintf( buf, "/proc/%d/task/%d/stat", getpid( ), mygettid( ) );
stat_fd = open( buf, O_RDONLY );
if ( stat_fd == -1 ) {
PAPIERROR( "open(%s)", buf );
return PAPI_ESYS;
}
rv = read( stat_fd, buf, LINE_MAX * sizeof ( char ) );
if ( rv == -1 ) {
if ( errno == EBADF ) {
close(stat_fd);
goto again;
}
PAPIERROR( "read()" );
close(stat_fd);
return PAPI_ESYS;
}
lseek( stat_fd, 0, SEEK_SET );
buf[rv] = '\0';
SUBDBG( "Thread stat file is:%s\n", buf );
while ( ( cnt != 13 ) && ( i < rv ) ) {
if ( buf[i] == ' ' ) {
cnt++;
}
i++;
}
if ( cnt != 13 ) {
PAPIERROR( "utime and stime not in thread stat file?" );
close(stat_fd);
return PAPI_ESYS;
}
if ( sscanf( buf + i, "%llu %llu", &utime, &stime ) != 2 ) {
close(stat_fd);
PAPIERROR("Unable to scan two items from thread stat file at 13th space?");
return PAPI_ESYS;
}
retval = ( utime + stime ) * ( long long ) 1000000 /_papi_os_info.clock_ticks;
close(stat_fd);
return retval;
}

| long long _linux_get_virt_usec_rusages | ( | void | ) |
| long long _linux_get_virt_usec_times | ( | void | ) |
Definition at line 350 of file linux-timer.c.
{
long long retval;
struct tms buffer;
times( &buffer );
SUBDBG( "user %d system %d\n", ( int ) buffer.tms_utime,
( int ) buffer.tms_stime );
retval = ( long long ) ( ( buffer.tms_utime + buffer.tms_stime ) *
1000000 / sysconf( _SC_CLK_TCK ));
/* NOT CLOCKS_PER_SEC as in the headers! */
return retval;
}
| int init_proc_thread_timer | ( | hwd_context_t * | thr_ctx | ) |

| int mmtimer_setup | ( | void | ) |
< No error
Definition at line 114 of file linux-timer.c.
{ return PAPI_OK; }
