Processor Counter Monitor
Classes | Macros | Typedefs | Functions
utils.h File Reference

Some common utility routines. More...

#include <cstdio>
#include <cstring>
#include <fstream>
#include <time.h>
#include "types.h"
#include <csignal>
#include <ctime>
#include <cmath>

Go to the source code of this file.

Classes

struct  null_stream
 
class  s_expect
 

Macros

#define PCM_UNUSED(x)   (void)(x)
 
#define PCM_COMPILE_ASSERT(condition)
 

Typedefs

typedef std::istringstream pcm_sscanf
 

Functions

void exit_cleanup (void)
 handler of exit() call
 
void set_signal_handlers (void)
 install various handlers for system signals
 
void restore_signal_handlers (void)
 Restores default signal handlers under Linux/UNIX.
 
void sigINT_handler (int signum)
 handles signals that lead to termination of the program such as SIGINT, SIGQUIT, SIGABRT, SIGSEGV, SIGTERM, SIGCHLD this function specifically works when the client aplication launched by pcm – terminates
 
void sigHUP_handler (int signum)
 handles signals that lead to restart the application such as SIGHUP. for example to re-read environment variables controlling PCM execution
 
void sigUSR_handler (int signum)
 handles signals that lead to update of configuration such as SIGUSR1 and SIGUSR2. for the future extensions
 
void sigSTOP_handler (int signum)
 handles signals that lead to update of configuration such as SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU
 
void sigCONT_handler (int signum)
 handles signals that lead to update of configuration such as SIGCONT
 
void set_post_cleanup_callback (void(*cb)(void))
 
void MySleep (int delay)
 
void MySleepMs (int delay_ms)
 
void MySleepUs (int delay_us)
 
void MySystem (char *sysCmd, char **argc)
 launches external program in a separate process
 
template<class IntType >
std::string unit_format (IntType n)
 
void print_cpu_details ()
 
std::istream & operator>> (std::istream &istr, s_expect &&s)
 
std::istream & operator>> (std::istream &&istr, s_expect &&s)
 
tm pcm_localtime ()
 

Detailed Description

Some common utility routines.

Macro Definition Documentation

#define PCM_COMPILE_ASSERT (   condition)
Value:
typedef char pcm_compile_assert_failed[(condition) ? 1 : -1]; \
pcm_compile_assert_failed pcm_compile_assert_failed_; \
PCM_UNUSED(pcm_compile_assert_failed_);