| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
JobHistory.cpp
Go to the documentation of this file.
1
2 //
3 // $Id: JobHistory.cpp,v 1.1 2006/11/09 10:24:05 mato Exp $
4 //
5 // GaudiHistory/JobHistory.cpp
6 //
7 // Contains history information for a job. Imports all environment vars
8 // and info from uname
9 //
10 //
11 // @author: Charles Leggett
12 //
14
15 #include "GaudiKernel/JobHistory.h"
16 #include "GaudiKernel/System.h"
17 #include "GaudiKernel/Property.h"
18
19 #include <cstdlib>
20 #include <iostream>
21
22 using std::string;
23 using std::ostream;
24 using std::endl;
25 using std::vector;
26
27 //**********************************************************************
28 // Member functions.
29 //**********************************************************************
30
31 // Constructor.
32
33 JobHistory::JobHistory()
34 : m_start_time(0) {
35
36 time(&m_start_time);
37
38 std::string rel;
39
40 if ( (rel = System::getEnv("ATLAS_BASE_RELEASE")) != "UNKNOWN" ) {
41 m_release_version = rel;
42 } else if ( (rel = System::getEnv("GAUDIROOT")) != "UNKNOWN" ) {
43 m_release_version = rel;
44 } else {
45 m_release_version = "UNKNOWN";
46 }
47 m_dir = System::getEnv("PWD");
48 m_cmtconfig = System::getEnv("CMTCONFIG");
49
50 m_osname = System::osName();
51 m_hostname = System::hostName();
52 m_os_version = System::osVersion();
53 m_machine = System::machineType();
54
55 m_environ = System::getEnv();
56
57 }
58
59 JobHistory::JobHistory(const std::string& rel, const std::string& os,
60 const std::string& host, const std::string& dir,
61 const std::string& osver, const std::string& mach,
62 const std::string& cmtconfig,
63 const time_t& time):
64 m_release_version(rel), m_dir(dir), m_cmtconfig(cmtconfig), m_osname(os),
65 m_hostname(host),
66 m_os_version(osver), m_machine(mach), m_start_time(time) {
67
68 }
69
70
71 //**********************************************************************
72
73 // Destructor.
74
75 JobHistory::~JobHistory() {
76 }
77
78 const CLID&
79 JobHistory::classID() {
80
81 static CLID CLID_JobHistory = 247994533;
82 return CLID_JobHistory;
83
84 }
85
86 void
87 JobHistory::addProperty(const std::string& client, const Property* prop) {
88 // if (m_props.find(prop) == m_props.end()) {
89 m_ppl.push_back( std::pair<std::string, const Property*>(client,prop) );
90 // }
91 }
92
93
94 void
95 JobHistory::dump(std::ostream& ost, const bool isXML, int /*ind*/) const {
96
97 if (!isXML) {
98 ost << "Release: " << release_version() << endl;
99 ost << "OS: " << os() << endl;
100 ost << "OS ver: " << os_version() << endl;
101 ost << "Host: " << hostname() << endl;
102 ost << "Machine: " << machine() << endl;
103 ost << "Run dir: " << dir() << endl;
104 ost << "CMTCONFIG: " << cmtconfig() << endl;
105 ost << "Job start time: " << start_time() << endl << endl;
106 ost << "Properties: [" << endl;;
107 for ( JobHistory::PropertyPairList::const_iterator
108 ipprop=propertyPairs().begin();
109 ipprop!=propertyPairs().end(); ++ipprop ) {
110 std::string client = ipprop->first;
111 const Property* prop = ipprop->second;
112 ost << client << ": ";
113 prop->fillStream(ost);
114 ost << endl;
115 }
116 ost << "]" << endl;
117 vector<string> env = environment();
118 for (vector<string>::const_iterator itr=env.begin(); itr != env.end();
119 ++itr) {
120 ost << *itr << endl;
121 }
122 } else {
123
124 }
125
126 }
127
128
129
130 //**********************************************************************
131 // Free functions.
132 //**********************************************************************
133
134 // Output stream.
135
136 ostream& operator<<(ostream& lhs, const JobHistory& rhs) {
137
138 rhs.dump(lhs,false);
139
140 return lhs;
141 }
142
143 //**********************************************************************