Panda3D
pStatFrameData.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file pStatFrameData.h
10  * @author drose
11  * @date 2000-07-10
12  */
13 
14 #ifndef PSTATFRAMEDATA_H
15 #define PSTATFRAMEDATA_H
16 
17 #include "pandabase.h"
18 
19 #include "pnotify.h"
20 
21 #include "pvector.h"
22 
23 class Datagram;
24 class DatagramIterator;
25 class PStatClientVersion;
26 class PStatClient;
27 
28 /**
29  * Contains the raw timing and level data for a single frame. This is a
30  * sequence of start/stop events, as well as a table of level values,
31  * associated with a number of collectors within a single frame.
32  */
33 class EXPCL_PANDA_PSTATCLIENT PStatFrameData {
34 public:
35  INLINE bool is_time_empty() const;
36  INLINE bool is_level_empty() const;
37  INLINE bool is_empty() const;
38  INLINE void clear();
39  INLINE void swap(PStatFrameData &other);
40 
41  INLINE void add_start(int index, double time);
42  INLINE void add_stop(int index, double time);
43  INLINE void add_level(int index, double level);
44 
45  void sort_time();
46 
47  INLINE double get_start() const;
48  INLINE double get_end() const;
49  INLINE double get_net_time() const;
50 
51  INLINE size_t get_num_events() const;
52  INLINE int get_time_collector(size_t n) const;
53  INLINE bool is_start(size_t n) const;
54  INLINE double get_time(size_t n) const;
55 
56  INLINE size_t get_num_levels() const;
57  INLINE int get_level_collector(size_t n) const;
58  INLINE double get_level(size_t n) const;
59 
60  bool write_datagram(Datagram &destination, PStatClient *client) const;
61  void read_datagram(DatagramIterator &source, PStatClientVersion *version);
62 
63 private:
64  class DataPoint {
65  public:
66  INLINE bool operator < (const DataPoint &other) const;
67 
68  int _index;
69  double _value;
70  };
71  typedef pvector<DataPoint> Data;
72 
73  Data _time_data, _level_data;
74 };
75 
76 #include "pStatFrameData.I"
77 
78 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Records the version number of a particular client.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Contains the raw timing and level data for a single frame.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
Manages the communications to report statistics via a network connection to a remote PStatServer.
Definition: pStatClient.h:263
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38