Otawa  0.10
Monitor.h
Go to the documentation of this file.
1 /*
2  * Monitor class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2014, IRIT UPS <casse@irit.fr>
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef OTAWA_PROC_MONITOR_H_
22 #define OTAWA_PROC_MONITOR_H_
23 
24 #include <otawa/base.h>
25 #include <otawa/properties.h>
26 
27 namespace otawa {
28 
29 using namespace elm;
30 class Processor;
31 class WorkSpace;
32 
33 
34 class Monitor {
35 public:
36  static Monitor& null;
37 
38  Monitor(void);
39 
40  typedef enum log_level_t {
41  LOG_NONE = 0,
42  LOG_PROC = 1,
43  LOG_FILE = 2,
44  LOG_DEPS = LOG_FILE,
45  LOG_FUN = 3,
46  LOG_CFG = LOG_FUN,
47  LOG_BLOCK = 4,
48  LOG_BB = LOG_BLOCK,
49  LOG_INST = 5
50  } log_level_t;
51 
52  // configuration
53  inline WorkSpace *workspace(void) { return ws; }
54 
55  // output and logging
58  inline bool isVerbose(void) const { return flags & IS_VERBOSE; }
59  inline bool logFor(log_level_t tested) const { return tested <= log_level; }
60  inline log_level_t logLevel(void) const { return log_level; }
61  void configure(const PropList& props);
62 
63 protected:
64  inline void setWorkspace(WorkSpace *workspace) { ws = workspace; }
65  static const t::uint32
66  IS_VERBOSE = 0x01,
67  CUSTOM_SHIFT = 16;
69 
70 private:
73 };
74 
75 // configuration
80 
81 } // otawa
82 
83 #endif /* OTAWA_PROC_MONITOR_H_ */
log_level_t logLevel(void) const
Definition: Monitor.h:60
log_level_t
Definition: Monitor.h:40
Identifier< bool > VERBOSE
This property activates the verbose mode of the processor: information about the processor work will ...
int flags
Identifier< Monitor::log_level_t > LOG_LEVEL
Property passed in the configuration property list of a processor to select the log level between LOG...
elm::io::Output log
Provide a stream to perform log output.
Definition: Monitor.h:57
WorkSpace * workspace(void)
Get the current workspace.
Definition: Monitor.h:53
static Monitor & null
Monitor that output nothing.
Definition: Monitor.h:36
bool isVerbose(void) const
Test if the verbosity is activated.
Definition: Monitor.h:58
log_level_t log_level
Definition: Monitor.h:71
Identifier< elm::io::OutStream * > LOG
This property identifier is used for setting the log stream used by the processor to write messages (...
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
Identifier< elm::io::OutStream * > OUTPUT
This property identifier is used for setting the output stream used by the processor to write results...
bool logFor(log_level_t tested) const
Test if the given log level is activated or not.
Definition: Monitor.h:59
void setWorkspace(WorkSpace *workspace)
Set the current workspace.
Definition: Monitor.h:64
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
WorkSpace * ws
Definition: Monitor.h:72
This a list of properties.
Definition: PropList.h:63
t::uint32 flags
Contains various bit flags.
Definition: Monitor.h:68
elm::io::Output out
Provide a stream to perform output for the user.
Definition: Monitor.h:56
uint32_t uint32