Xmipp  v3.23.11-Nereus
Protected Member Functions | Protected Attributes | List of all members
ProgTestWork Class Reference
Inheritance diagram for ProgTestWork:
Inheritance graph
[legend]
Collaboration diagram for ProgTestWork:
Collaboration graph
[legend]

Protected Member Functions

void defineParams ()
 
void readParams ()
 
void run ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 

Protected Attributes

int workTime
 
int randMin
 
int randMax
 
double param1
 
double param2
 
double df
 
double limit0
 
double limitF
 
bool do_limit0
 
bool do_limitF
 
std::string noise_type
 
- Protected Attributes inherited from XmippProgram
int errorCode
 
ProgramDefprogDef
 Program definition and arguments parser. More...
 
std::map< String, CommentListdefaultComments
 
int argc
 Original command line arguments. More...
 
const char ** argv
 

Additional Inherited Members

- Public Member Functions inherited from XmippProgram
const char * getParam (const char *param, int arg=0)
 
const char * getParam (const char *param, const char *subparam, int arg=0)
 
int getIntParam (const char *param, int arg=0)
 
int getIntParam (const char *param, const char *subparam, int arg=0)
 
double getDoubleParam (const char *param, int arg=0)
 
double getDoubleParam (const char *param, const char *subparam, int arg=0)
 
float getFloatParam (const char *param, int arg=0)
 
float getFloatParam (const char *param, const char *subparam, int arg=0)
 
void getListParam (const char *param, StringVector &list)
 
int getCountParam (const char *param)
 
bool checkParam (const char *param)
 
bool existsParam (const char *param)
 
void addParamsLine (const String &line)
 
void addParamsLine (const char *line)
 
ParamDefgetParamDef (const char *param) const
 
virtual void quit (int exit_code=0) const
 
virtual int tryRun ()
 
void initProgress (size_t total, size_t stepBin=60)
 
void setProgress (size_t value=0)
 
void endProgress ()
 
void processDefaultComment (const char *param, const char *left)
 
void setDefaultComment (const char *param, const char *comment)
 
virtual void initComments ()
 
void setProgramName (const char *name)
 
void addUsageLine (const char *line, bool verbatim=false)
 
void clearUsage ()
 
void addExampleLine (const char *example, bool verbatim=true)
 
void addSeeAlsoLine (const char *seeAlso)
 
void addKeywords (const char *keywords)
 
const char * name () const
 
virtual void usage (int verb=0) const
 
virtual void usage (const String &param, int verb=2)
 
int version () const
 
virtual void show () const
 
virtual void read (int argc, const char **argv, bool reportErrors=true)
 
virtual void read (int argc, char **argv, bool reportErrors=true)
 
void read (const String &argumentsLine)
 
 XmippProgram ()
 
 XmippProgram (int argc, const char **argv)
 
virtual ~XmippProgram ()
 
- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Detailed Description

Definition at line 30 of file work_test.cpp.

Member Function Documentation

◆ defineParams()

void ProgTestWork::defineParams ( )
inlineprotectedvirtual

Function in which the param of each Program are defined.

Reimplemented from XmippProgram.

Definition at line 40 of file work_test.cpp.

41  {
42  addUsageLine("Testing paralellization with some sleeping program.");
43  addParamsLine(" [--time <sec=5> ] : Number of seconds to sleep ");
44  addParamsLine(" [--rand <min=0> <max=2> ] : Randon variation (uniform distributed between min and max");
45  addParamsLine(" [--tag <string> ] : Tag to monitor. ");
46 
47  }
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ readParams()

void ProgTestWork::readParams ( )
inlineprotectedvirtual

Function in which each program will read parameters that it need. If some error occurs the usage will be printed out.

Reimplemented from XmippProgram.

Definition at line 49 of file work_test.cpp.

50  {
51  }

◆ run()

void ProgTestWork::run ( )
inlineprotectedvirtual

This function will be start running the program. it also should be implemented by derived classes.

Reimplemented from XmippProgram.

Definition at line 53 of file work_test.cpp.

54  {
55  size_t ms = getIntParam("--time") * 1000; // time in mili-seconds
56 
57  Timer t;
58  t.tic();
59 
60  while (true)
61  {
62  // Just waste some cpu cycles
63  for (int i = 0; i < 100000000; ++i);
64 
65  if (t.elapsed() >= ms)
66  break;
67  }
68  }
size_t tic()
#define i
size_t elapsed()
int getIntParam(const char *param, int arg=0)

Member Data Documentation

◆ df

double ProgTestWork::df
protected

Definition at line 36 of file work_test.cpp.

◆ do_limit0

bool ProgTestWork::do_limit0
protected

Definition at line 37 of file work_test.cpp.

◆ do_limitF

bool ProgTestWork::do_limitF
protected

Definition at line 37 of file work_test.cpp.

◆ limit0

double ProgTestWork::limit0
protected

Definition at line 36 of file work_test.cpp.

◆ limitF

double ProgTestWork::limitF
protected

Definition at line 36 of file work_test.cpp.

◆ noise_type

std::string ProgTestWork::noise_type
protected

Definition at line 38 of file work_test.cpp.

◆ param1

double ProgTestWork::param1
protected

Definition at line 35 of file work_test.cpp.

◆ param2

double ProgTestWork::param2
protected

Definition at line 35 of file work_test.cpp.

◆ randMax

int ProgTestWork::randMax
protected

Definition at line 33 of file work_test.cpp.

◆ randMin

int ProgTestWork::randMin
protected

Definition at line 33 of file work_test.cpp.

◆ workTime

int ProgTestWork::workTime
protected

Definition at line 33 of file work_test.cpp.


The documentation for this class was generated from the following file: