The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
SysProcStat.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11/*
12 * SysProcStat.cpp
13 *
14 * Created on: Jul 6, 2012
15 * Author: Ivan Valencik
16 */
17
18#include <RootCnv/SysProcStat.h>
19
20#include <cstdio>
21#include <sys/time.h>
22using namespace Gaudi;
23
25
26/*
27 * Update system performance values from /proc/self/stat virtaul file.
28 */
30 FILE* file = fopen( "/proc/self/stat", "r" );
31 int par = fscanf( file,
32 "%d %127s %c %d %d"
33 "%d %d %d %lu %lu"
34 "%lu %lu %lu %lu %lu"
35 "%ld %ld %ld %ld %ld"
36 "%ld %lu %lu %ld %lu"
37 "%lu %lu %lu %lu %lu"
38 "%lu %lu %lu %lu %lu"
39 "%lu %lu %d %d",
44 fclose( file );
45
46 if ( par != 39 ) return -1;
47
48 struct timeval tv;
49 gettimeofday( &tv, nullptr );
50 time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
51
52 return pid;
53}
long unsigned rlim
Definition SysProcStat.h:25
long unsigned utime
Definition SysProcStat.h:25
long unsigned cmajflt
Definition SysProcStat.h:25
long unsigned vsize
Definition SysProcStat.h:25
long unsigned startcode
Definition SysProcStat.h:25
long unsigned endcode
Definition SysProcStat.h:25
long unsigned majflt
Definition SysProcStat.h:25
long unsigned startime
Definition SysProcStat.h:25
long unsigned cminflt
Definition SysProcStat.h:25
virtual int update()
long unsigned sigcatch
Definition SysProcStat.h:26
long unsigned cnswap
Definition SysProcStat.h:26
long unsigned wchan
Definition SysProcStat.h:26
long unsigned startstack
Definition SysProcStat.h:26
long unsigned stime
Definition SysProcStat.h:25
long unsigned sigingore
Definition SysProcStat.h:26
long unsigned blocked
Definition SysProcStat.h:26
long unsigned kstkesp
Definition SysProcStat.h:26
long unsigned kstkeip
Definition SysProcStat.h:26
long unsigned nswap
Definition SysProcStat.h:26
long unsigned flags
Definition SysProcStat.h:25
long unsigned signal
Definition SysProcStat.h:26
long unsigned minflt
Definition SysProcStat.h:25
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1