| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Namespaces | Macros | Enumerations | Functions | Variables
ProcessDescriptor.cpp File Reference
`#include <errno.h>`
`#include <string>`
`#include "unistd.h"`
`#include "libgen.h"`
`#include <cstdio>`
`#include <sstream>`
`#include <iostream>`
`#include <fcntl.h>`
`#include "sys/times.h"`
`#include <sys/types.h>`
`#include <sys/signal.h>`
`#include <sys/syscall.h>`
`#include <sys/procfs.h>`
`#include <sys/time.h>`
`#include <sys/resource.h>`
`#include "ProcessDescriptor.h"`
`#include "GaudiKernel/ModuleInfo.h"`
`#include "GaudiKernel/System.h"`
Include dependency graph for ProcessDescriptor.cpp:

Go to the source code of this file.

## Classes
struct | linux_proc

## Namespaces
namespace | System
| Note: OS specific details for environment resolution.

## Macros
#define | GAUDIKERNEL_PROCSTAT_CPP
#define | WINVER 0
#define | s_myPid (::getpid())

## Enumerations
enum | System::ProcessInfoCommand { System::ProcessBasicInformation, System::ProcessQuotaLimits, System::ProcessIoCounters, System::ProcessVmCounters, System::ProcessTimes, System::ProcessBasePriority, System::ProcessRaisePriority, System::ProcessDebugPort, System::ProcessExceptionPort, System::ProcessAccessToken, System::ProcessLdtInformation, System::ProcessLdtSize, System::ProcessDefaultHardErrorMode, System::ProcessIoPortHandlers, System::ProcessPooledUsageAndLimits, System::ProcessWorkingSetWatch, System::ProcessUserModeIOPL, System::ProcessEnableAlignmentFaultFixup, System::ProcessPriorityClass, System::ProcessWx86Information, System::ProcessHandleCount, System::ProcessAffinityMask, System::ProcessPriorityBoost, System::MaxProcessInfoClass, System::ProcessEllapsedTime }

## Functions
void | readProcStat (long pid, linux_proc &pinfo)
static long | processID (long pid)

## Variables
static const long | TICK_TO_100NSEC = 100000
static long | pg_size = sysconf(_SC_PAGESIZE)

## Macro Definition Documentation

#define GAUDIKERNEL_PROCSTAT_CPP

Definition at line 15 of file ProcessDescriptor.cpp.

#define s_myPid (::getpid())

Definition at line 373 of file ProcessDescriptor.cpp.

#define WINVER 0

Definition at line 72 of file ProcessDescriptor.cpp.

## Function Documentation

static long processID | ( | long | pid | ) |
| inline static

Definition at line 374 of file ProcessDescriptor.cpp.

{
long thePid = (pid>0) ? pid : s_myPid;
return thePid;
}

void readProcStat | ( | long | pid,
|  | linux_proc & | pinfo
| ) |  |

Definition at line 303 of file ProcessDescriptor.cpp.

{
int cnt, fd;
char buf[512];
std::ostringstream ost;
ost << "/proc/" << pid << "/stat";
std::string fname = ost.str();
if((fd=open(fname.c_str(),O_RDONLY))<0) {
std::cerr << "Failed to open " << ost.str() << std::endl;
return;
}
lseek(fd,0,SEEK_SET);
if((cnt=read(fd,buf,sizeof(buf)))<0) {
std::cout << "LINUX Read of Proc file failed:" << std::endl;
close(fd);
return;
}
// Format
if(cnt>0) {
buf[cnt]='\0';
sscanf(buf,
//1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 20 1 2 3 4 5 6 7 8 9 30 1 2 3 4 5
"%d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %llu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
&pinfo.pid,
pinfo.comm,
&pinfo.state,
&pinfo.ppid,
&pinfo.pgrp,
&pinfo.session,
&pinfo.tty,
&pinfo.tpgid,
&pinfo.flags,
&pinfo.minflt,
&pinfo.cminflt,
&pinfo.majflt,
&pinfo.cmajflt,
&pinfo.utime,
&pinfo.stime,
&pinfo.cutime,
&pinfo.cstime,
&pinfo.priority,
&pinfo.nice,
&pinfo.num_threads,
&pinfo.itrealvalue,
&pinfo.starttime,
&pinfo.vsize,
&pinfo.rss,
&pinfo.rlim,
&pinfo.startcode,
&pinfo.endcode,
&pinfo.startstack,
&pinfo.kstkesp,
&pinfo.kstkeip,
&pinfo.signal,
&pinfo.blocked,
&pinfo.sigignore,
&pinfo.sigcatch,
&pinfo.wchan
);
}
close(fd);
}

## Variable Documentation

long pg_size = sysconf(_SC_PAGESIZE)
| static

Definition at line 301 of file ProcessDescriptor.cpp.

const long TICK_TO_100NSEC = 100000
| static

Definition at line 17 of file ProcessDescriptor.cpp.