powerd++  0.4.4
Namespaces | Typedefs | Enumerations | Functions | Variables
loadrec.cpp File Reference

Implements a load recorder, useful for simulating loads to test CPU clock daemons and settings. More...

#include "Options.hpp"
#include "types.hpp"
#include "constants.hpp"
#include "errors.hpp"
#include "utility.hpp"
#include "clas.hpp"
#include "version.hpp"
#include "sys/io.hpp"
#include "sys/sysctl.hpp"
#include <chrono>
#include <thread>
#include <memory>
#include <sys/resource.h>
Include dependency graph for loadrec.cpp:

Namespaces

 anonymous_namespace{loadrec.cpp}
 File local scope.
 

Typedefs

template<auto Ownership>
using anonymous_namespace{loadrec.cpp}::ofile = io::file< Ownership, io::write >
 Output file type alias. More...
 

Enumerations

enum  anonymous_namespace{loadrec.cpp}::OE {
  anonymous_namespace{loadrec.cpp}::OE::USAGE, anonymous_namespace{loadrec.cpp}::OE::IVAL_DURATION, anonymous_namespace{loadrec.cpp}::OE::IVAL_POLL, anonymous_namespace{loadrec.cpp}::OE::FILE_OUTPUT,
  anonymous_namespace{loadrec.cpp}::OE::FILE_PID, anonymous_namespace{loadrec.cpp}::OE::FLAG_VERBOSE, anonymous_namespace{loadrec.cpp}::OE::OPT_UNKNOWN, anonymous_namespace{loadrec.cpp}::OE::OPT_NOOPT,
  anonymous_namespace{loadrec.cpp}::OE::OPT_DASH, anonymous_namespace{loadrec.cpp}::OE::OPT_LDASH, anonymous_namespace{loadrec.cpp}::OE::OPT_DONE
}
 An enum for command line parsing. More...
 

Functions

template<typename... MsgTs>
void anonymous_namespace{loadrec.cpp}::verbose (MsgTs &&... msg)
 Outputs the given printf style message on stderr if g.verbose is set. More...
 
void anonymous_namespace{loadrec.cpp}::init ()
 Set up output to the given file.
 
void anonymous_namespace{loadrec.cpp}::read_args (int const argc, char const *const argv[])
 Parse command line arguments. More...
 
void anonymous_namespace{loadrec.cpp}::print_sysctls ()
 Print the sysctls. More...
 
void anonymous_namespace{loadrec.cpp}::run ()
 Report the load frames. More...
 
int main (int argc, char *argv[])
 Main routine, setup and execute daemon, print errors. More...
 

Variables

constexpr const flag_t anonymous_namespace{loadrec.cpp}::FEATURES
 The set of supported features. More...
 
struct {
bool verbose {false}
 Verbosity flag.
 
ms duration {30000}
 Recording duration in ms.
 
ms interval {25}
 Recording sample interval in ms.
 
ofile< io::link > fout = io::fout
 The output stream either io::fout (stdout) or a file.
 
const char * outfilename {nullptr}
 The user provided output file name.
 
const SysctlOnce< coreid_t, 2 > ncpu {1U, {CTL_HW, HW_NCPU}}
 The number of CPU cores/threads.
 
anonymous_namespace{loadrec.cpp}::g
 The global state.
 
const char *const anonymous_namespace{loadrec.cpp}::USAGE = "[-hv] [-d ival] [-p ival] [-o file]"
 The short usage string.
 
const Parameter< OE > anonymous_namespace{loadrec.cpp}::PARAMETERS []
 Definitions of command line parameters. More...
 

Detailed Description

Implements a load recorder, useful for simulating loads to test CPU clock daemons and settings.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main routine, setup and execute daemon, print errors.

Parameters
argc,argvThe command line arguments
Returns
An exit code
See also
Exit