-
Notifications
You must be signed in to change notification settings - Fork 0
/
GlobalWatcher.cc
126 lines (113 loc) · 2.16 KB
/
GlobalWatcher.cc
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
114
115
116
117
118
119
120
121
122
123
124
125
126
// -*- C++ -*-
//
// Package: Package
// Class : GlobalWatcher
//
// Implementation:
// [Notes on implementation]
//
// Original Author: Chris Jones
// Created: Thu, 30 May 2013 22:09:21 GMT
// $Id$
//
// system include files
#include <unistd.h>
#include <atomic>
#include <cstdio>
// user include files
#include "GlobalWatcher.h"
#include "Run.h"
#include "writeLock.h"
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// constructors and destructor
//
GlobalWatcher::GlobalWatcher()
{
}
// GlobalWatcher::GlobalWatcher(const GlobalWatcher& rhs)
// {
// // do actual copying here;
// }
//GlobalWatcher::~GlobalWatcher()
//{
//}
//
// assignment operators
//
// const GlobalWatcher& GlobalWatcher::operator=(const GlobalWatcher& rhs)
// {
// //An exception safe implementation is
// GlobalWatcher temp(rhs);
// swap(rhs);
//
// return *this;
// }
//
// member functions
//
//
// const member functions
//
void
GlobalWatcher::globalBeginRun(Run const&) const
{
++m_nBeginRunsSeen;
}
void
GlobalWatcher::globalEndRun(Run const& iRun) const
{
writeLock([&](){
printf("globalEndRun %u\n",iRun.number());
});
++m_nEndRunsSeen;
}
void
GlobalWatcher::beginStream(unsigned int) const
{
++m_nBeginStreamsSeen;
}
void
GlobalWatcher::streamBeginRun(unsigned int iStreamID, Run const&) const
{
unsigned int n = ++m_simultaneousBeginRuns;
writeLock([&](){
printf("#streamBeginRuns %u stream:%u\n",n,iStreamID);
});
usleep(100);
--m_simultaneousBeginRuns;
}
void
GlobalWatcher::event(unsigned int iStreamID, Event const&) const
{
++m_nEventsSeen;
unsigned int n = ++m_simultaneousEvents;
writeLock([&](){
printf("#events %u stream:%u\n",n,iStreamID);
});
usleep(1000);
--m_simultaneousEvents;
}
void
GlobalWatcher::streamEndRun(unsigned int iStreamID, Run const&) const
{
unsigned int n = ++m_simultaneousEndRuns;
writeLock([&](){
printf("#streamEndRuns %u stream:%u\n",n,iStreamID);
});
usleep(100);
--m_simultaneousEndRuns;
}
void
GlobalWatcher::endStream(unsigned int) const
{
++m_nEndStreamsSeen;
}
//
// static member functions
//