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