Icemon  3.3
icecc-monitor is a monitoring application for icecc (a distributed compiler)
job.h
1 /*
2  This file is part of Icecream.
3 
4  Copyright (c) 2003 Frerich Raabe <raabe@kde.org>
5  Copyright (c) 2003,2004 Stephan Kulow <coolo@kde.org>
6  Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.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 2 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 GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 #ifndef ICEMON_JOB_H
23 #define ICEMON_JOB_H
24 
25 #include <QString>
26 #include <time.h>
27 #include <QMap>
28 #include <qdebug.h>
29 
30 class Job
31 {
32 public:
33  enum State { WaitingForCS, LocalOnly, Compiling, Finished, Failed, Idle };
34 
35  explicit Job(unsigned int id = 0,
36  unsigned int client = 0,
37  const QString &filename = QString(),
38  const QString &lang = QString());
39 
40  bool operator==(const Job &rhs) const { return id == rhs.id; }
41  bool operator!=(const Job &rhs) const { return id != rhs.id; }
42  int operator<(const Job &rhs) const { return id < rhs.id; }
43 
44  QString stateAsString() const;
45  bool isDone() const { return state == Finished || state == Failed; }
46  bool isActive() const { return state == LocalOnly || state == Compiling; }
47 
48  unsigned int id;
49  QString fileName;
50  unsigned int server;
51  unsigned int client;
52  QString lang;
53  State state;
54  time_t startTime;
55 
56  unsigned int real_msec; /* real time it used */
57  unsigned int user_msec; /* user time used */
58  unsigned int sys_msec; /* system time used */
59  unsigned int pfaults; /* page faults */
60 
61  int exitcode; /* exit code */
62 
63  unsigned int in_compressed;
64  unsigned int in_uncompressed;
65  unsigned int out_compressed;
66  unsigned int out_uncompressed;
67 };
68 
69 QDebug operator<<(QDebug dbg, const Job &job);
70 
71 class IdleJob
72  : public Job
73 {
74 public:
75  IdleJob()
76  : Job() { state = Job::Idle; }
77 };
78 
79 typedef QMap<unsigned int, Job> JobList;
80 
81 #endif
82 // vim:ts=4:sw=4:noet
Definition: job.h:30
Definition: job.h:71