LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
pex_logging
11.0+1
src
BlockTimingLog.cc
Go to the documentation of this file.
1
/*
2
* LSST Data Management System
3
* Copyright 2008, 2009, 2010 LSST Corporation.
4
*
5
* This product includes software developed by the
6
* LSST Project (http://www.lsst.org/).
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the LSST License Statement and
19
* the GNU General Public License along with this program. If not,
20
* see <http://www.lsstcorp.org/LegalNotices/>.
21
*/
22
28
#include "
lsst/pex/logging/BlockTimingLog.h
"
29
#include <fstream>
30
31
namespace
lsst {
32
namespace
pex {
33
namespace
logging {
34
35
const
int
BlockTimingLog::INSTRUM
=
logging::Log::INFO
- 3;
36
37
const
std::string
BlockTimingLog::STATUS
(
"STATUS"
);
38
const
std::string
BlockTimingLog::START
(
"start"
);
39
const
std::string
BlockTimingLog::END
(
"end"
);
40
41
BlockTimingLog::BlockTimingLog
(
const
Log
& parent,
const
std::string&
name
,
42
int
tracelev,
int
usageFlags,
43
const
std::string& funcName)
44
:
Log
(parent, name), _tracelev(tracelev), _pusageFlags(0),
45
_usageFlags(usageFlags), _funcName(funcName), _usage()
46
47
{
48
if
(
_funcName
.length() == 0)
_funcName
= name;
49
const
BlockTimingLog
*p =
dynamic_cast<
const
BlockTimingLog
*
>
(&parent);
50
if
(
_tracelev
==
Log::INHERIT_THRESHOLD
) {
51
if
(p) {
52
_tracelev
= p->
getInstrumentationLevel
();
53
}
54
else
{
55
_tracelev
=
INSTRUM
;
56
}
57
}
58
if
(
_usageFlags
==
PARENTUDATA
) {
59
if
(p)
addUsageFlags
(p->
getUsageFlags
());
60
}
61
}
62
63
BlockTimingLog::~BlockTimingLog
() { }
64
65
void
BlockTimingLog::addUsageProps
(
LogRecord
& rec) {
66
if
(!
_usage
.get())
_usage
.reset(
new
struct
rusage());
67
68
if
(getrusage(RUSAGE_SELF,
_usage
.get()) == 0) {
69
double
d = 0;
70
if
(
_usageFlags
&
UTIME
) {
71
d =
_usage
->ru_utime.tv_sec +
_usage
->ru_utime.tv_usec/1.0e6;
72
rec.
addProperty
(
"usertime"
, d);
73
}
74
if
(
_usageFlags
&
STIME
) {
75
d =
_usage
->ru_utime.tv_sec +
_usage
->ru_utime.tv_usec/1.0e6;
76
rec.
addProperty
(
"systemtime"
, d);
77
}
78
if
(
_usageFlags
&
MEMSZ
) rec.
addProperty
(
"maxrss"
,
_usage
->ru_maxrss);
79
if
(
_usageFlags
&
MINFLT
) rec.
addProperty
(
"minflt"
,
_usage
->ru_minflt);
80
if
(
_usageFlags
&
MAJFLT
) rec.
addProperty
(
"majflt"
,
_usage
->ru_majflt);
81
if
(
_usageFlags
&
NSWAP
) rec.
addProperty
(
"nswap"
,
_usage
->ru_nswap);
82
if
(
_usageFlags
&
BLKIN
) rec.
addProperty
(
"blocksin"
,
_usage
->ru_inblock);
83
if
(
_usageFlags
&
BLKOUT
) rec.
addProperty
(
"blocksout"
,
_usage
->ru_oublock);
84
}
85
}
86
87
}}}
// end lsst::pex::logging
lsst::pex::logging::BlockTimingLog::_funcName
std::string _funcName
Definition:
BlockTimingLog.h:338
BlockTimingLog.h
definition of the BlockTimingLog class
name
table::Key< std::string > name
Definition:
ApCorrMap.cc:71
lsst::pex::logging::BlockTimingLog::PARENTUDATA
Definition:
BlockTimingLog.h:141
lsst::pex::logging::BlockTimingLog::START
static const std::string START
Definition:
BlockTimingLog.h:159
lsst::pex::logging::BlockTimingLog::BlockTimingLog
BlockTimingLog(const Log &parent, const std::string &name, int tracelev=BlockTimingLog::INSTRUM, int usageFlags=PARENTUDATA, const std::string &funcName="")
Definition:
BlockTimingLog.cc:41
lsst::pex::logging::BlockTimingLog::_tracelev
int _tracelev
Definition:
BlockTimingLog.h:336
lsst::pex::logging::Log
a place to record messages and descriptions of the state of processing.
Definition:
Log.h:154
lsst::pex::logging::BlockTimingLog::getUsageFlags
int getUsageFlags() const
Definition:
BlockTimingLog.h:205
lsst::pex::logging::BlockTimingLog::BLKOUT
Definition:
BlockTimingLog.h:106
lsst::pex::logging::LogRecord
a container for constructing a single Log record
Definition:
LogRecord.h:99
lsst::pex::logging::Log::INHERIT_THRESHOLD
static const int INHERIT_THRESHOLD
Definition:
Log.h:183
lsst::pex::logging::BlockTimingLog::STATUS
static const std::string STATUS
Definition:
BlockTimingLog.h:153
lsst::pex::logging::Log::INFO
static const int INFO
Definition:
Log.h:171
lsst::pex::logging::BlockTimingLog::MEMSZ
Definition:
BlockTimingLog.h:91
lsst::pex::logging::LogRecord::addProperty
void addProperty(const RecordProperty< T > &property)
Definition:
LogRecord.h:327
lsst::pex::logging::BlockTimingLog::BLKIN
Definition:
BlockTimingLog.h:101
lsst::pex::logging::BlockTimingLog::_usageFlags
int _usageFlags
Definition:
BlockTimingLog.h:337
lsst::pex::logging::BlockTimingLog::getInstrumentationLevel
int getInstrumentationLevel() const
Definition:
BlockTimingLog.h:321
lsst::pex::logging::BlockTimingLog::_usage
boost::scoped_ptr< struct rusage > _usage
Definition:
BlockTimingLog.h:339
lsst::pex::logging::BlockTimingLog::~BlockTimingLog
virtual ~BlockTimingLog()
Definition:
BlockTimingLog.cc:63
lsst::pex::logging::BlockTimingLog::MINFLT
Definition:
BlockTimingLog.h:118
lsst::pex::logging::BlockTimingLog::addUsageFlags
void addUsageFlags(int flags)
Definition:
BlockTimingLog.h:227
lsst::pex::logging::BlockTimingLog::addUsageProps
void addUsageProps(LogRecord &rec)
Definition:
BlockTimingLog.cc:65
lsst::pex::logging::BlockTimingLog::MAJFLT
Definition:
BlockTimingLog.h:124
lsst::pex::logging::BlockTimingLog::END
static const std::string END
Definition:
BlockTimingLog.h:165
lsst::pex::logging::BlockTimingLog::UTIME
Definition:
BlockTimingLog.h:74
lsst::pex::logging::BlockTimingLog::STIME
Definition:
BlockTimingLog.h:79
lsst::pex::logging::BlockTimingLog
Definition:
BlockTimingLog.h:59
lsst::pex::logging::BlockTimingLog::INSTRUM
static const int INSTRUM
Definition:
BlockTimingLog.h:147
lsst::pex::logging::BlockTimingLog::NSWAP
Definition:
BlockTimingLog.h:96
Generated on Thu Sep 24 2015 02:29:23 for LSSTApplications by
1.8.5