Opened 13 years ago
Closed 12 years ago
#442 closed enhancement (done)
New features in time_report.h
Reported by: | Alpar Juttner | Owned by: | Alpar Juttner |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.3 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: |
Description
The attached patch adds two new features
- The output of
TimeReport
can be suspended using itsactive
attribute - The format of the time printing can now be configured as a global parameter. Two formats implemented:
NORMAL
: It prints all the values measured byTimeStamp
. This is the format that was implemented before.SHORT
: It prints the real (wall clock) time plus an error indicator (in percentage) calculated as follows.(realTime()-(userTime()+systemTime()+cUserTime()+cSystemTime())/realTime()
The second feature needs a static member, which prohibits using time_measure.h
as an include only header. Being it is mainly a developing/testing tool, I don't think it is a major problem.
Attachments (1)
Change History (5)
Changed 13 years ago by
Attachment: | c40a9d94442d.patch added |
---|
comment:1 follow-up: 2 Changed 12 years ago by
comment:2 Changed 12 years ago by
The reason for the global parameter is that a frequent use of TimeStamp
is through TimeReport
, where the value printed by the destructor. In addition, I don't think anyone would like to use both versions in the same code, but instead the user wants to set his preference globally.
comment:4 Changed 12 years ago by
Resolution: | → done |
---|---|
Status: | new → closed |
Merged to the main branch, see [c40a9d94442d].
I like these changes.
However, the global parameter is a bit strange for me. Wouldn't it be better to avoid such parameter and provide two separate query functions of type
std::string
(e.g.string()
,shortString()
orformat()
,shortFormat()
etc.)? Andoperator<<
would simply use one of them. Another possible solution would be to keep this option and its setters/getters but as a local field ofTimeStamp
objects and introduce a functionconst TimeStamp& short() const
to provide a copy/view of the original object with short format parameter.