File: jobstat.cpp

package info (click to toggle)
icecc 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,520 kB
  • sloc: cpp: 14,058; sh: 3,006; ansic: 767; xml: 744; makefile: 231; asm: 2
file content (113 lines) | stat: -rw-r--r-- 2,647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 99; -*- */
/* vim: set ts=4 sw=4 et tw=99:  */
/*
    This file is part of Icecream.

    Copyright (c) 2004 Michael Matz <matz@suse.de>
                  2004 Stephan Kulow <coolo@suse.de>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "jobstat.h"

JobStat::JobStat()
    : m_outputSize(0)
    , m_compileTimeReal(0)
    , m_compileTimeUser(0)
    , m_compileTimeSys(0)
    , m_jobId(0)
{
}

unsigned long JobStat::outputSize() const
{
    return m_outputSize;
}

void JobStat::setOutputSize(unsigned long size)
{
    m_outputSize = size;
}

unsigned long JobStat::compileTimeReal() const
{
    return m_compileTimeReal;
}

void JobStat::setCompileTimeReal(unsigned long time)
{
    m_compileTimeReal = time;
}

unsigned long JobStat::compileTimeUser() const
{
    return m_compileTimeUser;
}

void JobStat::setCompileTimeUser(unsigned long time)
{
    m_compileTimeUser = time;
}

unsigned long JobStat::compileTimeSys() const
{
    return m_compileTimeSys;
}

void JobStat::setCompileTimeSys(unsigned long time)
{
    m_compileTimeSys = time;
}

unsigned int JobStat::jobId() const
{
    return m_jobId;
}

void JobStat::setJobId(unsigned int id)
{
    m_jobId = id;
}

JobStat& JobStat::operator+=(const JobStat& st)
{
    m_outputSize += st.m_outputSize;
    m_compileTimeReal += st.m_compileTimeReal;
    m_compileTimeUser += st.m_compileTimeUser;
    m_compileTimeSys +=  st.m_compileTimeSys;
    m_jobId = 0;
    return *this;
}

JobStat& JobStat::operator-=(const JobStat &st)
{
    m_outputSize -= st.m_outputSize;
    m_compileTimeReal -= st.m_compileTimeReal;
    m_compileTimeUser -= st.m_compileTimeUser;
    m_compileTimeSys -= st.m_compileTimeSys;
    m_jobId = 0;
    return *this;
}

JobStat& JobStat::operator/=(int d)
{
    m_outputSize /= d;
    m_compileTimeReal /= d;
    m_compileTimeUser /= d;
    m_compileTimeSys /= d;
    m_jobId = 0;
    return *this;
}