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& tracePacket, const vogl_trace_gl_entrypoint_packet& glPacket)
44 : m_pParentFrame(pFrame),
46 m_tracePacket(tracePacket),
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()
62 inline vogleditor_frameItem* frame() const
64 return m_pParentFrame;
67 inline uint64_t globalCallIndex() const
69 return m_globalCallIndex;
72 inline uint64_t startTime() const
77 inline uint64_t endTime() const
82 inline uint64_t duration() const
84 return endTime() - startTime();
87 const vogl_trace_gl_entrypoint_packet* getGLPacket() const
92 vogl_trace_packet* getTracePacket()
94 return &m_tracePacket;
97 inline uint64_t backtraceHashIndex() const
99 return m_backtrace_hash_index;
103 vogleditor_frameItem* m_pParentFrame;
104 const vogl_trace_gl_entrypoint_packet m_glPacket;
105 vogl_trace_packet m_tracePacket;
107 uint64_t m_globalCallIndex;
108 uint64_t m_begin_rdtsc;
109 uint64_t m_end_rdtsc;
110 uint64_t m_backtrace_hash_index;
113 #endif // VOGLEDITOR_APICALLITEM_H