7 #include "sys/sysctl.h"
11 #include "sys/sysinfo.h"
14 using namespace lcio ;
15 using namespace marlin ;
24 _description =
"Simple processor to print out the memory consumption at defined intervals" ;
27 "Print Event Number Every N Events",
56 struct task_basic_info t_info;
57 mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
59 if (KERN_SUCCESS != task_info(mach_task_self(),
60 TASK_BASIC_INFO, (task_info_t)&t_info,
63 streamlog_out(ERROR) <<
"Problem accessing system information from MacOS X!"<<
std::endl ;
66 streamlog_out(MESSAGE) <<
" Processed event "<<
_eventNumber
67 <<
" Resident size is: "<< t_info.resident_size<<
" virtual size: "<<t_info.virtual_size
71 struct sysinfo memInfo;
75 unsigned long physMemUsed = memInfo.totalram - memInfo.freeram;
79 streamlog_out(MESSAGE) <<
" Processed event "<<
_eventNumber
80 <<
" Physical memory in use: "<<physMemUsed
96 streamlog_out(MESSAGE) <<
"MemoryMonitor::end() " <<
name() <<
" processed " <<
_eventNumber <<
" events in " <<
_runNumber <<
" runs "
void registerProcessorParameter(const std::string ¶meterName, const std::string ¶meterDescription, T ¶meter, const T &defaultVal, int setSize=0)
Register a steering variable for this processor - call in constructor of processor.
virtual const std::string & name() const
Return name of this processor.
MemoryMonitor is a memory monitoring application for Marlin.
virtual void end()
Called after data processing for clean up in the inverse order of the init() method so that resources...
MemoryMonitor aMemoryMonitor
void printParameters()
Print the parameters and their values depending on the given verbosity level.
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
virtual void check(LCEvent *evt)
Called for every event - right after processEvent() has been called for this processor.
virtual void init()
Called at the begin of the job before anything is read.
Base class for Marlin processors.
std::string _description
Describes what the processor does.
virtual void processRunHeader(LCRunHeader *run)
Called for every run, e.g.