PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-timer.h File Reference
This graph shows which files directly or indirectly include this file:

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)
 

Function Documentation

long long _linux_get_real_cycles ( void  )

Definition at line 245 of file linux-timer.c.

246 {
247  long long retval;
248 #if defined(HAVE_GETTIMEOFDAY)||defined(__powerpc__)||defined(__arm__)||defined(__mips__)
249 
250  /* Crude estimate, not accurate in prescence of DVFS */
251 
252  retval = _papi_os_vector.get_real_usec( ) *
254 #else
255  retval = get_cycles( );
256 #endif
257  return retval;
258 }
long long(* get_real_usec)(void)
Definition: papi_vector.h:63
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
long long
Definition: iozone.c:19827
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
#define get_cycles
Definition: linux-bgq.c:48
int cpu_max_mhz
Definition: papi.h:791
ssize_t retval
Definition: libasync.c:338
long long _linux_get_real_nsec_gettime ( void  )

Definition at line 466 of file linux-timer.c.

467 {
468 
469  long long retval;
470 
471  struct timespec foo;
472 #ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
473  syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
474 #else
475  syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
476 #endif
477  retval = ( long long ) foo.tv_sec * ( long long ) 1000000000;
478  retval += ( long long ) ( foo.tv_nsec );
479 
480  return retval;
481 }
pthread_attr_t foo
Definition: iozone.c:18592
long long
Definition: iozone.c:19827
ssize_t retval
Definition: libasync.c:338
long long _linux_get_real_usec_cycles ( void  )

Definition at line 310 of file linux-timer.c.

311 {
312 
313  long long retval;
314 
315  /* Not accurate in the prescence of DVFS */
316 
317  retval = get_cycles( ) /
319 
320  return retval;
321 }
long long
Definition: iozone.c:19827
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
PAPI_hw_info_t hw_info
#define get_cycles
Definition: linux-bgq.c:48
int cpu_max_mhz
Definition: papi.h:791
ssize_t retval
Definition: libasync.c:338
long long _linux_get_real_usec_gettime ( void  )

Definition at line 273 of file linux-timer.c.

274 {
275 
276  long long retval;
277 
278  struct timespec foo;
279 #ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
280  syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
281 #else
282  syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
283 #endif
284  retval = ( long long ) foo.tv_sec * ( long long ) 1000000;
285  retval += ( long long ) ( foo.tv_nsec / 1000 );
286 
287  return retval;
288 }
pthread_attr_t foo
Definition: iozone.c:18592
long long
Definition: iozone.c:19827
ssize_t retval
Definition: libasync.c:338
long long _linux_get_real_usec_gettimeofday ( void  )

Definition at line 295 of file linux-timer.c.

296 {
297 
298  long long retval;
299 
300  struct timeval buffer;
301  gettimeofday( &buffer, NULL );
302  retval = ( long long ) buffer.tv_sec * ( long long ) 1000000;
303  retval += ( long long ) ( buffer.tv_usec );
304 
305  return retval;
306 }
long long
Definition: iozone.c:19827
char * buffer
Definition: iozone.c:1366
ssize_t retval
Definition: libasync.c:338
long long _linux_get_virt_nsec_gettime ( void  )

Definition at line 489 of file linux-timer.c.

490 {
491 
492  long long retval;
493 
494  struct timespec foo;
495 
496  syscall( __NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &foo );
497  retval = ( long long ) foo.tv_sec * ( long long ) 1000000000;
498  retval += ( long long ) foo.tv_nsec ;
499 
500  return retval;
501 }
pthread_attr_t foo
Definition: iozone.c:18592
long long
Definition: iozone.c:19827
ssize_t retval
Definition: libasync.c:338
long long _linux_get_virt_usec_gettime ( void  )

Definition at line 376 of file linux-timer.c.

377 {
378 
379  long long retval;
380 
381  struct timespec foo;
382 
383  syscall( __NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &foo );
384  retval = ( long long ) foo.tv_sec * ( long long ) 1000000;
385  retval += ( long long ) foo.tv_nsec / 1000;
386 
387  return retval;
388 }
pthread_attr_t foo
Definition: iozone.c:18592
long long
Definition: iozone.c:19827
ssize_t retval
Definition: libasync.c:338
long long _linux_get_virt_usec_pttimer ( void  )

Definition at line 395 of file linux-timer.c.

396 {
397 
398  long long retval;
399  char buf[LINE_MAX];
400  long long utime, stime;
401  int rv, cnt = 0, i = 0;
402  int stat_fd;
403 
404 
405 again:
406  sprintf( buf, "/proc/%d/task/%d/stat", getpid( ), mygettid( ) );
407  stat_fd = open( buf, O_RDONLY );
408  if ( stat_fd == -1 ) {
409  PAPIERROR( "open(%s)", buf );
410  return PAPI_ESYS;
411  }
412 
413  rv = read( stat_fd, buf, LINE_MAX * sizeof ( char ) );
414  if ( rv == -1 ) {
415  if ( errno == EBADF ) {
416  close(stat_fd);
417  goto again;
418  }
419  PAPIERROR( "read()" );
420  close(stat_fd);
421  return PAPI_ESYS;
422  }
423  lseek( stat_fd, 0, SEEK_SET );
424 
425  if (rv == LINE_MAX) rv--;
426  buf[rv] = '\0';
427  SUBDBG( "Thread stat file is:%s\n", buf );
428  while ( ( cnt != 13 ) && ( i < rv ) ) {
429  if ( buf[i] == ' ' ) {
430  cnt++;
431  }
432  i++;
433  }
434 
435  if ( cnt != 13 ) {
436  PAPIERROR( "utime and stime not in thread stat file?" );
437  close(stat_fd);
438  return PAPI_ESYS;
439  }
440 
441  if ( sscanf( buf + i, "%llu %llu", &utime, &stime ) != 2 ) {
442  close(stat_fd);
443  PAPIERROR("Unable to scan two items from thread stat file at 13th space?");
444  return PAPI_ESYS;
445  }
446 
447  retval = ( utime + stime ) * ( long long ) 1000000 /_papi_os_info.clock_ticks;
448 
449  close(stat_fd);
450 
451  return retval;
452 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int errno
int close(int fd)
Definition: appio.c:175
off_t lseek(int fd, off_t offset, int whence)
Definition: appio.c:210
static pid_t mygettid(void)
Definition: darwin-common.h:11
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:184
int i
Definition: fileop.c:140
char buf[200]
Definition: iozone.c:19609
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
#define PAPI_ESYS
Definition: fpapi.h:108
sscanf(mnc->m_child_port,"%d",&mc.m_child_port)
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

long long _linux_get_virt_usec_rusages ( void  )
long long _linux_get_virt_usec_times ( void  )

Definition at line 352 of file linux-timer.c.

353 {
354 
355  long long retval;
356 
357  struct tms buffer;
358 
359  times( &buffer );
360 
361  SUBDBG( "user %d system %d\n", ( int ) buffer.tms_utime,
362  ( int ) buffer.tms_stime );
363  retval = ( long long ) ( ( buffer.tms_utime + buffer.tms_stime ) *
364  1000000 / sysconf( _SC_CLK_TCK ));
365 
366  /* NOT CLOCKS_PER_SEC as in the headers! */
367 
368  return retval;
369 }
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
long long
Definition: iozone.c:19827
char * buffer
Definition: iozone.c:1366
ssize_t retval
Definition: libasync.c:338
int init_proc_thread_timer ( hwd_context_t thr_ctx)

Here is the caller graph for this function:

int mmtimer_setup ( void  )

Definition at line 116 of file linux-timer.c.

116 { return PAPI_OK; }
return PAPI_OK
Definition: linux-nvml.c:458

Here is the caller graph for this function: