COIN-OR::LEMON - Graph Library

Opened 12 years ago

Closed 11 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 its active 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 by TimeStamp. 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)

c40a9d94442d.patch (4.2 KB) - added by Alpar Juttner 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by Alpar Juttner

Attachment: c40a9d94442d.patch added

comment:1 Changed 11 years ago by Peter Kovacs

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() or format(), shortFormat() etc.)? And operator<< would simply use one of them. Another possible solution would be to keep this option and its setters/getters but as a local field of TimeStamp objects and introduce a function const TimeStamp& short() const to provide a copy/view of the original object with short format parameter.

comment:2 in reply to:  1 Changed 11 years ago by Alpar Juttner

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:3 Changed 11 years ago by Peter Kovacs

I see. Then this patch can be pushed to the main branch.

comment:4 Changed 11 years ago by Alpar Juttner

Resolution: done
Status: newclosed

Merged to the main branch, see [c40a9d94442d].

Note: See TracTickets for help on using tickets.