rippled
Event.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of Beast: https://github.com/vinniefalco/Beast
4  Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef BEAST_INSIGHT_EVENT_H_INCLUDED
21 #define BEAST_INSIGHT_EVENT_H_INCLUDED
22 
23 #include <ripple/beast/insight/EventImpl.h>
24 
25 #include <chrono>
26 #include <memory>
27 
28 namespace beast {
29 namespace insight {
30 
40 class Event final
41 {
42 public:
44 
49  {
50  }
51 
58  {
59  }
60 
62  template <class Rep, class Period>
63  void
65  {
66  using namespace std::chrono;
67  if (m_impl)
68  m_impl->notify(ceil<value_type>(value));
69  }
70 
72  impl() const
73  {
74  return m_impl;
75  }
76 
77 private:
79 };
80 
81 } // namespace insight
82 } // namespace beast
83 
84 #endif
std::shared_ptr
STL class.
std::chrono::milliseconds
beast::insight::EventImpl::value_type
std::chrono::milliseconds value_type
Definition: EventImpl.h:34
beast::insight::Event::m_impl
std::shared_ptr< EventImpl > m_impl
Definition: Event.h:78
chrono
beast::insight::Event::Event
Event()
Create a null metric.
Definition: Event.h:48
beast::insight::Event
A metric for reporting event timing.
Definition: Event.h:40
memory
beast::insight::Event::Event
Event(std::shared_ptr< EventImpl > const &impl)
Create the metric reference the specified implementation.
Definition: Event.h:57
beast::insight::Event::impl
std::shared_ptr< EventImpl > const & impl() const
Definition: Event.h:72
beast::insight::Event::notify
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
Definition: Event.h:64
beast
Definition: base_uint.h:641
std::chrono