1 /**************************************************************************
3 * Copyright 2013-2014 RAD Game Tools and Valve Software
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
26 #ifndef VOGLEDITOR_APICALLITEM_H
27 #define VOGLEDITOR_APICALLITEM_H
31 // external classes (could be predeclared)
32 #include "vogl_common.h"
33 #include "vogl_trace_packet.h"
35 #include "vogleditor_snapshotitem.h"
37 // predeclared classes
38 class vogleditor_frameItem;
40 class vogleditor_apiCallItem : public vogleditor_snapshotItem
43 vogleditor_apiCallItem(vogleditor_frameItem* pFrame, vogl_trace_packet* pTracePacket, const vogl_trace_gl_entrypoint_packet& glPacket)
44 : m_pParentFrame(pFrame),
46 m_pTracePacket(pTracePacket),
47 m_globalCallIndex(glPacket.m_call_counter),
48 m_begin_rdtsc(glPacket.m_packet_begin_rdtsc),
49 m_end_rdtsc(glPacket.m_packet_end_rdtsc),
50 m_backtrace_hash_index(glPacket.m_backtrace_hash_index)
52 if (m_end_rdtsc < m_begin_rdtsc)
54 m_end_rdtsc = m_begin_rdtsc + 1;
58 ~vogleditor_apiCallItem()
60 if (m_pTracePacket != NULL)
62 vogl_delete(m_pTracePacket);
63 m_pTracePacket = NULL;
67 inline vogleditor_frameItem* frame() const
69 return m_pParentFrame;
72 inline uint64_t globalCallIndex() const
74 return m_globalCallIndex;
77 inline uint64_t startTime() const
82 inline uint64_t endTime() const
87 inline uint64_t duration() const
89 return endTime() - startTime();
92 const vogl_trace_gl_entrypoint_packet* getGLPacket() const
97 vogl_trace_packet* getTracePacket()
99 return m_pTracePacket;
102 inline uint64_t backtraceHashIndex() const
104 return m_backtrace_hash_index;
108 vogleditor_frameItem* m_pParentFrame;
109 const vogl_trace_gl_entrypoint_packet m_glPacket;
110 vogl_trace_packet* m_pTracePacket;
112 uint64_t m_globalCallIndex;
113 uint64_t m_begin_rdtsc;
114 uint64_t m_end_rdtsc;
115 uint64_t m_backtrace_hash_index;
118 #endif // VOGLEDITOR_APICALLITEM_H