Commit | Line | Data |
---|---|---|
72b9787e JB |
1 | /***************************************************************************** |
2 | * Copyright (C) 2013 x265 project | |
3 | * | |
4 | * Authors: Steve Borho <steve@borho.org> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. | |
19 | * | |
20 | * This program is also available under a commercial proprietary license. | |
21 | * For more information, contact us at license @ x265.com. | |
22 | *****************************************************************************/ | |
23 | ||
24 | #ifndef _PPA_API_H_ | |
25 | #define _PPA_API_H_ | |
26 | ||
27 | namespace ppa { | |
28 | // PPA private namespace | |
29 | ||
30 | typedef unsigned short EventID; | |
31 | typedef unsigned char GroupID; | |
32 | ||
33 | class Base | |
34 | { | |
35 | public: | |
36 | ||
37 | virtual ~Base() {} | |
38 | ||
39 | virtual bool isEventFiltered(EventID eventId) const = 0; | |
40 | virtual bool configEventById(EventID eventId, bool filtered) const = 0; | |
41 | virtual int configGroupById(GroupID groupId, bool filtered) const = 0; | |
42 | virtual void configAllEvents(bool filtered) const = 0; | |
43 | virtual EventID registerEventByName(const char *pEventName) = 0; | |
44 | virtual GroupID registerGroupByName(const char *pGroupName) = 0; | |
45 | virtual EventID registerEventInGroup(const char *pEventName, GroupID groupId) = 0; | |
46 | virtual void triggerStartEvent(EventID eventId) = 0; | |
47 | virtual void triggerEndEvent(EventID eventId) = 0; | |
48 | virtual void triggerTidEvent(EventID eventId, unsigned int data) = 0; | |
49 | virtual void triggerDebugEvent(EventID eventId, unsigned int data0, unsigned int data1) = 0; | |
50 | ||
51 | virtual EventID getEventId(int index) const = 0; | |
52 | ||
53 | protected: | |
54 | ||
55 | virtual void init(const char **pNames, int eventCount) = 0; | |
56 | }; | |
b53f7c52 JB |
57 | |
58 | extern ppa::Base *ppabase; | |
59 | ||
60 | struct ProfileScope | |
61 | { | |
62 | ppa::EventID id; | |
63 | ||
64 | ProfileScope(int e) { if (ppabase) { id = ppabase->getEventId(e); ppabase->triggerStartEvent(id); } else id = 0; } | |
65 | ~ProfileScope() { if (ppabase) ppabase->triggerEndEvent(id); } | |
66 | }; | |
67 | ||
72b9787e JB |
68 | } |
69 | ||
70 | #endif //_PPA_API_H_ |