| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

SysProcStat.cpp
Go to the documentation of this file.
1 /*
2 * SysProcStat.cpp
3 *
4 * Created on: Jul 6, 2012
5 * Author: Ivan Valencik
6 */
7
8 #include "RootCnv/SysProcStat.h"
9
10 #include <cstdio>
11 #include <sys/time.h>
12 using namespace Gaudi;
13
14 SysProcStat::SysProcStat() {
15 update();
16 }
17
18
19 /*
20 * Update system performance values from /proc/self/stat virtaul file.
21 */
22 int SysProcStat::update() {
23 FILE* file = fopen("/proc/self/stat", "r");
24 int par = fscanf(file,
25 "%d %s %c %d %d"
26 "%d %d %d %lu %lu"
27 "%lu %lu %lu %lu %lu"
28 "%ld %ld %ld %ld %ld"
29 "%ld %lu %lu %ld %lu"
30 "%lu %lu %lu %lu %lu"
31 "%lu %lu %lu %lu %lu"
32 "%lu %lu %d %d",
33 &pid, comm, &state, &ppid, &pgrp,
34 &session, &tty_nr, &tpgid, &flags, &minflt,
35 &cminflt, &majflt, &cmajflt, &utime, &stime,
36 &cutime, &cstime, &priority, &nice, &num_threads,
37 &itrealvalue, &startime, &vsize, &rss, &rlim,
38 &startcode, &endcode, &startstack, &kstkesp, &kstkeip,
39 &signal, &blocked, &sigingore, &sigcatch, &wchan,
40 &nswap, &cnswap, &exit_signal, &processor);
41 fclose(file);
42
43 if (par != 39) return -1;
44
45 struct timeval tv;
46 gettimeofday(&tv, nullptr);
47 time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
48
49 return pid;
50 }
Gaudi::SysProcStat::tty_nr
int tty_nr
Definition: SysProcStat.h:16
Gaudi::SysProcStat::sigingore
long unsigned sigingore
Definition: SysProcStat.h:17
Gaudi::SysProcStat::stime
long unsigned stime
Definition: SysProcStat.h:17
Gaudi::SysProcStat::startcode
long unsigned startcode
Definition: SysProcStat.h:17
Gaudi::SysProcStat::cutime
long int cutime
Definition: SysProcStat.h:20
Gaudi::SysProcStat::sigcatch
long unsigned sigcatch
Definition: SysProcStat.h:17
Gaudi::SysProcStat::cstime
long int cstime
Definition: SysProcStat.h:20
Gaudi::SysProcStat::SysProcStat
SysProcStat()
Definition: SysProcStat.cpp:14
Gaudi::SysProcStat::blocked
long unsigned blocked
Definition: SysProcStat.h:17
SysProcStat.h
Gaudi::SysProcStat::nice
long int nice
Definition: SysProcStat.h:20
Gaudi::SysProcStat::cminflt
long unsigned cminflt
Definition: SysProcStat.h:17
Gaudi::SysProcStat::nswap
long unsigned nswap
Definition: SysProcStat.h:17
Gaudi::SysProcStat::majflt
long unsigned majflt
Definition: SysProcStat.h:17
Gaudi::SysProcStat::pgrp
int pgrp
Definition: SysProcStat.h:16
Gaudi::SysProcStat::minflt
long unsigned minflt
Definition: SysProcStat.h:17
Gaudi::SysProcStat::ppid
int ppid
Definition: SysProcStat.h:16
Gaudi::SysProcStat::itrealvalue
long int itrealvalue
Definition: SysProcStat.h:20
Gaudi::SysProcStat::kstkeip
long unsigned kstkeip
Definition: SysProcStat.h:17
Gaudi::SysProcStat::processor
int processor
Definition: SysProcStat.h:16
Gaudi::SysProcStat::wchan
long unsigned wchan
Definition: SysProcStat.h:17
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
Gaudi::SysProcStat::vsize
long unsigned vsize
Definition: SysProcStat.h:17
Gaudi::SysProcStat::comm
char comm[128]
Definition: SysProcStat.h:21
Gaudi::SysProcStat::update
virtual int update()
Definition: SysProcStat.cpp:22
Gaudi::SysProcStat::cnswap
long unsigned cnswap
Definition: SysProcStat.h:17
Gaudi::SysProcStat::time
long time
Definition: SysProcStat.h:23
Gaudi::SysProcStat::cmajflt
long unsigned cmajflt
Definition: SysProcStat.h:17
ana.file
list file
Definition: ana.py:160
Gaudi::SysProcStat::state
char state
Definition: SysProcStat.h:21
Gaudi::SysProcStat::signal
long unsigned signal
Definition: SysProcStat.h:17
Gaudi::SysProcStat::utime
long unsigned utime
Definition: SysProcStat.h:17
Gaudi::SysProcStat::tpgid
int tpgid
Definition: SysProcStat.h:16
Gaudi::SysProcStat::kstkesp
long unsigned kstkesp
Definition: SysProcStat.h:17
Gaudi::SysProcStat::startstack
long unsigned startstack
Definition: SysProcStat.h:17
Gaudi::SysProcStat::rlim
long unsigned rlim
Definition: SysProcStat.h:17
Gaudi::SysProcStat::priority
long int priority
Definition: SysProcStat.h:20
Gaudi::SysProcStat::session
int session
Definition: SysProcStat.h:16
Gaudi::SysProcStat::rss
long int rss
Definition: SysProcStat.h:20
Gaudi::SysProcStat::pid
int pid
Definition: SysProcStat.h:16
Gaudi::SysProcStat::exit_signal
int exit_signal
Definition: SysProcStat.h:16
Gaudi::SysProcStat::flags
long unsigned flags
Definition: SysProcStat.h:17
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
Gaudi::SysProcStat::startime
long unsigned startime
Definition: SysProcStat.h:17
Gaudi::SysProcStat::num_threads
long int num_threads
Definition: SysProcStat.h:20
Gaudi::SysProcStat::endcode
long unsigned endcode
Definition: SysProcStat.h:17