DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ThrottleStream.hpp
Go to the documentation of this file.
1/*
2 * ThrottleStream.h
3 * ers
4 *
5 * Created by Gordon Crone on 02.08.05.
6 * Copyright 2004 CERN. All rights reserved.
7 *
8 */
9
10#ifndef ERS_THROTTLE_STREAM_H
11#define ERS_THROTTLE_STREAM_H
12
13#include <map>
14#include <mutex>
15
16#include <ers/OutputStream.hpp>
17
18namespace ers
19{
35 public:
36 explicit ThrottleStream(const std::string &criteria);
37
38 void write(const ers::Issue &issue) override;
39
40 private:
42 public:
44 void reset();
45
46 std::time_t m_lastOccurance;
47 std::time_t m_lastReport;
52 };
53
54 private:
55 void throttle(IssueRecord &record, const ers::Issue &issue);
56
57 void reportSuppression(IssueRecord &record, const ers::Issue &issue);
58
59 typedef std::map<std::string, IssueRecord> IssueMap;
61
64 std::mutex m_mutex;
65 };
66}
67
68#endif
Base class for any user define issue.
Definition Issue.hpp:69
ERS abstract output stream interface.
Throws issues as exceptions.
void reportSuppression(IssueRecord &record, const ers::Issue &issue)
std::map< std::string, IssueRecord > IssueMap
void write(const ers::Issue &issue) override
void throttle(IssueRecord &record, const ers::Issue &issue)
ThrottleStream(const std::string &criteria)