Go to the source code of this file.
◆ _linux_get_real_cycles()
| long long _linux_get_real_cycles |
( |
void |
| ) |
|
Definition at line 312 of file linux-timer.c.
313{
315#if defined(HAVE_GETTIMEOFDAY)||defined(__arm__)||defined(__mips__)
316
317
318
321#else
323#endif
325}
papi_os_vector_t _papi_os_vector
papi_mdi_t _papi_hwi_system_info
long long(* get_real_usec)(void)
◆ _linux_get_real_nsec_gettime()
| long long _linux_get_real_nsec_gettime |
( |
void |
| ) |
|
Definition at line 533 of file linux-timer.c.
534{
535
537
539#ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
540 syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
541#else
542 syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
543#endif
544 retval = (
long long ) foo.tv_sec * (
long long ) 1000000000;
546
548}
◆ _linux_get_real_usec_cycles()
| long long _linux_get_real_usec_cycles |
( |
void |
| ) |
|
◆ _linux_get_real_usec_gettime()
| long long _linux_get_real_usec_gettime |
( |
void |
| ) |
|
Definition at line 340 of file linux-timer.c.
341{
342
344
346#ifdef HAVE_CLOCK_GETTIME_REALTIME_HR
347 syscall( __NR_clock_gettime, CLOCK_REALTIME_HR, &foo );
348#else
349 syscall( __NR_clock_gettime, CLOCK_REALTIME, &foo );
350#endif
351 retval = (
long long ) foo.tv_sec * (
long long ) 1000000;
352 retval += (
long long ) ( foo.tv_nsec / 1000 );
353
355}
◆ _linux_get_real_usec_gettimeofday()
| long long _linux_get_real_usec_gettimeofday |
( |
void |
| ) |
|
Definition at line 362 of file linux-timer.c.
363{
364
366
368 gettimeofday( &buffer, NULL );
369 retval = (
long long ) buffer.tv_sec * (
long long ) 1000000;
371
373}
◆ _linux_get_virt_nsec_gettime()
| long long _linux_get_virt_nsec_gettime |
( |
void |
| ) |
|
Definition at line 556 of file linux-timer.c.
557{
558
560
562
563 syscall( __NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &foo );
564 retval = (
long long ) foo.tv_sec * (
long long ) 1000000000;
566
568}
◆ _linux_get_virt_usec_gettime()
| long long _linux_get_virt_usec_gettime |
( |
void |
| ) |
|
Definition at line 443 of file linux-timer.c.
444{
445
447
449
450 syscall( __NR_clock_gettime, CLOCK_THREAD_CPUTIME_ID, &foo );
451 retval = (
long long ) foo.tv_sec * (
long long ) 1000000;
453
455}
◆ _linux_get_virt_usec_pttimer()
| long long _linux_get_virt_usec_pttimer |
( |
void |
| ) |
|
Definition at line 462 of file linux-timer.c.
463{
464
467 long long utime, stime;
468 int rv, cnt = 0,
i = 0;
469 int stat_fd;
470
471
472again:
473 sprintf(
buf,
"/proc/%d/task/%d/stat", getpid( ),
mygettid( ) );
474 stat_fd =
open(
buf, O_RDONLY );
475 if ( stat_fd == -1 ) {
478 }
479
480 rv =
read( stat_fd,
buf, LINE_MAX *
sizeof (
char ) );
481 if ( rv == -1 ) {
482 if (
errno == EBADF ) {
484 goto again;
485 }
489 }
490 lseek( stat_fd, 0, SEEK_SET );
491
492 if (rv == LINE_MAX) rv--;
494 SUBDBG(
"Thread stat file is:%s\n",
buf );
495 while ( ( cnt != 13 ) && (
i < rv ) ) {
496 if (
buf[
i] ==
' ' ) {
497 cnt++;
498 }
500 }
501
502 if ( cnt != 13 ) {
503 PAPIERROR(
"utime and stime not in thread stat file?" );
506 }
507
508 if ( sscanf(
buf +
i,
"%llu %llu", &utime, &stime ) != 2 ) {
510 PAPIERROR(
"Unable to scan two items from thread stat file at 13th space?");
512 }
513
515
517
519}
PAPI_os_info_t _papi_os_info
int open(const char *pathname, int flags, mode_t mode)
off_t lseek(int fd, off_t offset, int whence)
ssize_t read(int fd, void *buf, size_t count)
static pid_t mygettid(void)
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
#define SUBDBG(format, args...)
void PAPIERROR(char *format,...)
◆ _linux_get_virt_usec_rusage()
| long long _linux_get_virt_usec_rusage |
( |
void |
| ) |
|
Definition at line 397 of file linux-timer.c.
398{
399
401
402 struct rusage buffer;
403
404 getrusage( RUSAGE_SELF, &buffer );
405 SUBDBG(
"user %d system %d\n", (
int ) buffer.ru_utime.tv_sec,
406 ( int ) buffer.ru_stime.tv_sec );
407 retval = (
long long ) ( buffer.ru_utime.tv_sec + buffer.ru_stime.tv_sec )
408 * (
long long ) 1000000;
409 retval += (
long long) ( buffer.ru_utime.tv_usec + buffer.ru_stime.tv_usec );
410
412}
◆ _linux_get_virt_usec_times()
| long long _linux_get_virt_usec_times |
( |
void |
| ) |
|
Definition at line 419 of file linux-timer.c.
420{
421
423
424 struct tms buffer;
425
426 times( &buffer );
427
428 SUBDBG(
"user %d system %d\n", (
int ) buffer.tms_utime,
429 ( int ) buffer.tms_stime );
430 retval = (
long long ) ( ( buffer.tms_utime + buffer.tms_stime ) *
431 1000000 / sysconf( _SC_CLK_TCK ));
432
433
434
436}
◆ mmtimer_setup()
| int mmtimer_setup |
( |
void |
| ) |
|
Definition at line 130 of file linux-timer.c.
130 {
131
132#if defined(__powerpc__)
134#endif