]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_apicallitem.h
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_apicallitem.h
1 /**************************************************************************
2  *
3  * Copyright 2013-2014 RAD Game Tools and Valve Software
4  * All Rights Reserved.
5  *
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:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
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
22  * THE SOFTWARE.
23  *
24  **************************************************************************/
25
26 #ifndef VOGLEDITOR_APICALLITEM_H
27 #define VOGLEDITOR_APICALLITEM_H
28
29 #include <QList>
30
31 // external classes (could be predeclared)
32 #include "vogl_common.h"
33 #include "vogl_trace_packet.h"
34
35 #include "vogleditor_snapshotitem.h"
36
37 // predeclared classes
38 class vogleditor_frameItem;
39
40 class vogleditor_apiCallItem : public vogleditor_snapshotItem
41 {
42 public:
43    vogleditor_apiCallItem(vogleditor_frameItem* pFrame, vogl_trace_packet& tracePacket, const vogl_trace_gl_entrypoint_packet& glPacket)
44        : m_pParentFrame(pFrame),
45         m_glPacket(glPacket),
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)
51    {
52       if (m_end_rdtsc < m_begin_rdtsc)
53       {
54          m_end_rdtsc = m_begin_rdtsc + 1;
55       }
56    }
57
58    ~vogleditor_apiCallItem()
59    {
60    }
61
62    inline vogleditor_frameItem* frame() const
63    {
64       return m_pParentFrame;
65    }
66
67    inline uint64_t globalCallIndex() const
68    {
69       return m_globalCallIndex;
70    }
71
72    inline uint64_t startTime() const
73    {
74       return m_begin_rdtsc;
75    }
76
77    inline uint64_t endTime() const
78    {
79       return m_end_rdtsc;
80    }
81
82    inline uint64_t duration() const
83    {
84       return endTime() - startTime();
85    }
86
87    const vogl_trace_gl_entrypoint_packet* getGLPacket() const
88    {
89       return &m_glPacket;
90    }
91
92    vogl_trace_packet* getTracePacket()
93    {
94       return &m_tracePacket;
95    }
96
97    inline uint64_t backtraceHashIndex() const
98    {
99        return m_backtrace_hash_index;
100    }
101
102 private:
103    vogleditor_frameItem* m_pParentFrame;
104    const vogl_trace_gl_entrypoint_packet m_glPacket;
105    vogl_trace_packet m_tracePacket;
106
107    uint64_t m_globalCallIndex;
108    uint64_t m_begin_rdtsc;
109    uint64_t m_end_rdtsc;
110    uint64_t m_backtrace_hash_index;
111 };
112
113 #endif // VOGLEDITOR_APICALLITEM_H