source: src/Helpers/Info.cpp@ 8e24ef

Last change on this file since 8e24ef was 8e24ef, checked in by Frederik Heber <heber@…>, 15 years ago

Chronos is so far fully working.

  • Library version is now 7:0:0, API version is 1.1.0.
  • using either time.h or sys/times.h if present to measure timing.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * Info.cpp
10 *
11 * Created on: Nov 25, 2009
12 * Author: heber
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "MemDebug.hpp"
21
22#include "Chronos.hpp"
23#include "Info.hpp"
24#include "Log.hpp"
25#include "Verbose.hpp"
26
27int Info::verbosity = 0;
28Chronos * Info::timekeeper = NULL;
29bool Info::ChronosBlocker = false;
30size_t Info::NumberInfos = 0;
31
32/**
33 * Constructor. Do not use this function. Use getInstance() instead.
34 *
35 * \return Info instance
36 */
37Info::Info(const char *msg) :
38 FunctionName(msg)
39{
40 verbosity++;
41 LOG(0, "INFO: Begin of "+FunctionName);
42
43 // one more info object
44 ++NumberInfos;
45
46 // have pointer ready
47 if (timekeeper == NULL) {
48 timekeeper = Chronos::getPointer();
49 }
50
51 // start time keeping
52 timekeeper->startTiming(FunctionName);
53}
54
55/**
56 * Destructor. Better use purgeInstance().
57 */
58Info::~Info()
59{
60 // end time keeping
61 timekeeper->endTiming(FunctionName);
62
63 // verbosity stuff
64 LOG(0, "INFO: End of "+FunctionName);
65 verbosity--;
66
67 // one info object less
68 --NumberInfos;
69
70 // we are last one?
71 if (!NumberInfos) {
72 timekeeper = NULL;
73 }
74}
75
76/**
77 * Sets the verbosity.
78 *
79 * \param verbosityLevel verbosity
80 */
81void Info::setVerbosity(int verbosityLevel)
82{
83 verbosity = verbosityLevel;
84}
Note: See TracBrowser for help on using the repository browser.