Panda3D
Loading...
Searching...
No Matches
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
23class Datagram;
26class 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 */
33class EXPCL_PANDA_PSTATCLIENT PStatFrameData {
34public:
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;
62
63private:
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
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
Records the version number of a particular client.
Manages the communications to report statistics via a network connection to a remote PStatServer.
Contains the raw timing and level data for a single frame.
void sort_time()
Ensures the frame data is in monotonically increasing order by time.
void swap(PStatFrameData &other)
Exchanges the data in this object with the data in the other.
bool is_empty() const
Returns true if the FrameData has no time or level data.
void read_datagram(DatagramIterator &source, PStatClientVersion *version)
Extracts the FrameData definition from the datagram.
double get_end() const
Returns the time of the last data point in the frame data.
double get_time(size_t n) const
Returns the timestamp of the nth event, in seconds elapsed since some undefined epoch (which is guara...
int get_time_collector(size_t n) const
Returns the index of the collector associated with the nth event.
size_t get_num_levels() const
Returns the number of individual level values stored in the FrameData.
bool is_start(size_t n) const
Returns true if the nth event represents a start event, or false if it represents a stop event.
double get_net_time() const
Returns the total time elapsed for the frame.
double get_start() const
Returns the time of the first data point in the frame data.
size_t get_num_events() const
Returns the number of individual events stored in the FrameData.
bool is_time_empty() const
Returns true if there are no time events in the frame data, false otherwise.
bool write_datagram(Datagram &destination, PStatClient *client) const
Writes the definition of the FrameData to the datagram.
void add_level(int index, double level)
Adds a particular level value associated with a given collector to the frame data.
double get_level(size_t n) const
Returns the height of the nth level value.
void add_stop(int index, double time)
Adds a 'stop collector' data point to the frame data.
bool is_level_empty() const
Returns true if there are no levels indicated in the frame data, false otherwise.
void clear()
Removes all the data points from the frame data, in preparation for building up a new frame's worth.
int get_level_collector(size_t n) const
Returns the index of the collector associated with the nth level value.
void add_start(int index, double time)
Adds a 'start collector' data point to the frame data.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.