• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef OSP_PUBLIC_NETWORK_METRICS_H_
6 #define OSP_PUBLIC_NETWORK_METRICS_H_
7 
8 #include <cstdint>
9 
10 #include "osp/public/timestamp.h"
11 
12 namespace openscreen {
13 namespace osp {
14 
15 // Holds a set of metrics, captured over a specific range of time, about the
16 // behavior of a network service running in the library.
17 struct NetworkMetrics {
18   NetworkMetrics() = default;
19   ~NetworkMetrics() = default;
20 
21   // The range of time over which the metrics were collected; end_timestamp >
22   // start_timestamp
23   timestamp_t start_timestamp = 0;
24   timestamp_t end_timestamp = 0;
25 
26   // The number of packets and bytes sent over the timestamp range.
27   uint64_t packets_sent = 0;
28   uint64_t bytes_sent = 0;
29 
30   // The number of packets and bytes received over the timestamp range.
31   uint64_t packets_received = 0;
32   uint64_t bytes_received = 0;
33 
34   // The maximum number of connections over the timestamp range.  The
35   // latter two fields break this down by connections to ipv4 and ipv6
36   // endpoints.
37   size_t max_connections = 0;
38   size_t max_ipv4_connections = 0;
39   size_t max_ipv6_connections = 0;
40 };
41 
42 }  // namespace osp
43 }  // namespace openscreen
44 
45 #endif  // OSP_PUBLIC_NETWORK_METRICS_H_
46