DiskStats.hpp 3.33 KB
Newer Older
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
/******************************************************************************
 *
 * This file is part of the Castor project.
 * See http://castor.web.cern.ch/castor
 *
 * Copyright (C) 2014  CERN
 * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * 
 *
 * @author Castor Dev team, castor-dev@cern.ch
 *****************************************************************************/

#pragma once

namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
  /**
   * Structure holding the timers and stats for the tape session. We use doubles, 
   * for time and all measurements are in seconds or uint64_t for bytes.
   */
  struct DiskStats {
    /** Mounting time, in seconds */
    double openingTime;
    
38
    /** Closing time, in seconds */
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    double closingTime;
    
    /** Cumulated time spent computing checksums */
    double checksumingTime;
    
    /** Cumulated time spent transfering data with the disk */
    double transferTime;
    
    /** Cumulated time spent waiting for data blocks. */
    double waitDataTime;
    
    /** Cumulated time spent waiting for free memory. */
    double waitFreeMemoryTime;
    
    /** Cumulated time spent by the tape thread waiting for a task. */
    double waitInstructionsTime;
    
    /** Cumulated time spent reporting */
    double waitReportingTime;
  
    /** Cumulated time spent reporting */
    double checkingErrorTime;
    
62
63
64
    /** Total real time spent by the thread/pool. */
    double totalTime;
    
65
66
67
68
69
70
71
72
    /** Cumulated data volume (actual payload), in bytes. */
    uint64_t dataVolume;
    
    /** Count of files actually transfered in the session. */
    uint64_t filesCount;
    
    /** Constructor: all defaults are zero */
    DiskStats():  openingTime(0.0), 
73
    closingTime(0.0),
74
75
76
77
78
79
    checksumingTime(0.0),
    transferTime(0.0),
    waitDataTime(0.0), 
    waitFreeMemoryTime(0.0),
    waitInstructionsTime(0.0),
    waitReportingTime(0.0), 
80
81
    checkingErrorTime(0.0),
    totalTime(0.0),
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    dataVolume(0),
    filesCount(0) {}
    
    /** Accumulate contents of another stats block */

    void operator+=(const DiskStats& other) {
      openingTime += other.openingTime;
      closingTime += other.closingTime;
      checksumingTime += other.checksumingTime;
      transferTime += other.transferTime;
      waitDataTime += other.waitDataTime;
      waitFreeMemoryTime += other.waitFreeMemoryTime;
      waitInstructionsTime += other.waitInstructionsTime;
      waitReportingTime += other.waitReportingTime;
      checkingErrorTime += other.checkingErrorTime;
97
      // total time is not a cumulative member. It is used to represent wallclock time.
98
99
100
101
102
103
104
      filesCount += other.filesCount;
      dataVolume += other.dataVolume;
    }
  };
  
}}}}