11d77d6caf647424f9c1c481145be0465e96c9e3eBrian
21d77d6caf647424f9c1c481145be0465e96c9e3eBrian/*
31d77d6caf647424f9c1c481145be0465e96c9e3eBrian * Copyright (C) Texas Instruments - http://www.ti.com/
41d77d6caf647424f9c1c481145be0465e96c9e3eBrian *
559a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul * This library is free software; you can redistribute it and/or
61d77d6caf647424f9c1c481145be0465e96c9e3eBrian * modify it under the terms of the GNU Lesser General Public
71d77d6caf647424f9c1c481145be0465e96c9e3eBrian * License as published by the Free Software Foundation; either
81d77d6caf647424f9c1c481145be0465e96c9e3eBrian * version 2.1 of the License, or (at your option) any later version.
91d77d6caf647424f9c1c481145be0465e96c9e3eBrian *
101d77d6caf647424f9c1c481145be0465e96c9e3eBrian *
111d77d6caf647424f9c1c481145be0465e96c9e3eBrian * This library is distributed in the hope that it will be useful,
121d77d6caf647424f9c1c481145be0465e96c9e3eBrian * but WITHOUT ANY WARRANTY; without even the implied warranty of
131d77d6caf647424f9c1c481145be0465e96c9e3eBrian * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
141d77d6caf647424f9c1c481145be0465e96c9e3eBrian * Lesser General Public License for more details.
151d77d6caf647424f9c1c481145be0465e96c9e3eBrian *
161d77d6caf647424f9c1c481145be0465e96c9e3eBrian *
171d77d6caf647424f9c1c481145be0465e96c9e3eBrian * You should have received a copy of the GNU Lesser General Public
181d77d6caf647424f9c1c481145be0465e96c9e3eBrian * License along with this library; if not, write to the Free Software
191d77d6caf647424f9c1c481145be0465e96c9e3eBrian * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
201d77d6caf647424f9c1c481145be0465e96c9e3eBrian */
211d77d6caf647424f9c1c481145be0465e96c9e3eBrian/* This headerdescribes the external PERF interface */
221d77d6caf647424f9c1c481145be0465e96c9e3eBrian#ifndef __PERF_H__
231d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define __PERF_H__
241d77d6caf647424f9c1c481145be0465e96c9e3eBrian
251d77d6caf647424f9c1c481145be0465e96c9e3eBrian/* global flag */
261d77d6caf647424f9c1c481145be0465e96c9e3eBrian#ifdef __PERF_INSTRUMENTATION__
271d77d6caf647424f9c1c481145be0465e96c9e3eBrian
281d77d6caf647424f9c1c481145be0465e96c9e3eBrian/** Compile-tempTime configuration options
291d77d6caf647424f9c1c481145be0465e96c9e3eBrian*
301d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   In order to facilitate more flexible configuration options,
311d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   yet maintain run-tempTime performance, we allow the following
321d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   configuration options:
331d77d6caf647424f9c1c481145be0465e96c9e3eBrian*
341d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   __PERF_CUSTOMIZABLE__
351d77d6caf647424f9c1c481145be0465e96c9e3eBrian*
361d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   If enabled, we allow customized implementation of the
374f25420bdd834e81a3e22733304efc5261c2998aBrian Paul*   performance interface, e.g. unbuffered debug prints to find
384f25420bdd834e81a3e22733304efc5261c2998aBrian Paul*   the point of a program crash. For more information on the
39abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca*   specific features supported, see perf_custom.h.
404f25420bdd834e81a3e22733304efc5261c2998aBrian Paul*
411d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   If disabled, all instrumentation calls are hard-coded to be
421d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   logged into a logging buffer.
431d77d6caf647424f9c1c481145be0465e96c9e3eBrian* */
441d77d6caf647424f9c1c481145be0465e96c9e3eBrian
451d77d6caf647424f9c1c481145be0465e96c9e3eBrian#if defined(__PERF_LOG_LOCATION__)
461907135235a684872706d1a28ea8e2b4e1b6e7d3Brian Paul    #define __PERF_Location(hObject) \
471907135235a684872706d1a28ea8e2b4e1b6e7d3Brian Paul        __PERF_FN(Location) (hObject,__FILE__,__LINE__,__func__);
481907135235a684872706d1a28ea8e2b4e1b6e7d3Brian Paul#elif defined(__PERF_LOCATE__)
491d77d6caf647424f9c1c481145be0465e96c9e3eBrian    #define __PERF_Location(hObject) \
501d77d6caf647424f9c1c481145be0465e96c9e3eBrian        fprintf(stderr,"PERF in [%s:%d func:%s]:",__FILE__,__LINE__,__func__);
511d77d6caf647424f9c1c481145be0465e96c9e3eBrian#else
521d77d6caf647424f9c1c481145be0465e96c9e3eBrian    #define __PERF_Location(hObject)
531d77d6caf647424f9c1c481145be0465e96c9e3eBrian#endif
543197ad5a56ee94773f974ac727b316c5adfe1b6fBrian
551d77d6caf647424f9c1c481145be0465e96c9e3eBrian#ifdef __PERF_CUSTOMIZABLE__
561d77d6caf647424f9c1c481145be0465e96c9e3eBrian    #define __PERF_FN(a) __PERF_CUSTOM_##a
571d77d6caf647424f9c1c481145be0465e96c9e3eBrian#else
583197ad5a56ee94773f974ac727b316c5adfe1b6fBrian    #define __PERF_FN(a) __PERF_LOG_##a
593197ad5a56ee94773f974ac727b316c5adfe1b6fBrian#endif
601d77d6caf647424f9c1c481145be0465e96c9e3eBrian
611d77d6caf647424f9c1c481145be0465e96c9e3eBrian/*=============================================================================
621d77d6caf647424f9c1c481145be0465e96c9e3eBrian    Overall API methodology.
631d77d6caf647424f9c1c481145be0465e96c9e3eBrian
641d77d6caf647424f9c1c481145be0465e96c9e3eBrian    Since this is an instrumentation API, other than the create call, no
651d77d6caf647424f9c1c481145be0465e96c9e3eBrian    other methods return any value, so there is no error checking
661d77d6caf647424f9c1c481145be0465e96c9e3eBrian    requirements.
671d77d6caf647424f9c1c481145be0465e96c9e3eBrian
681d77d6caf647424f9c1c481145be0465e96c9e3eBrian    If the create call encounters any errors, or if the instrumentation is run-
691d77d6caf647424f9c1c481145be0465e96c9e3eBrian    tempTime disabled, it will return NULL.  All other API-s must handle a NULL
701d77d6caf647424f9c1c481145be0465e96c9e3eBrian    argument, and will do nothing in such case.
7163428372cadc73a7124f4e7d383eb86a0c7affd7Francisco Jerez=============================================================================*/
7263428372cadc73a7124f4e7d383eb86a0c7affd7Francisco Jerez
731d77d6caf647424f9c1c481145be0465e96c9e3eBrian/* Four CC calculations from characters and string */
741d77d6caf647424f9c1c481145be0465e96c9e3eBrian
751d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_FOURCC(a,b,c,d)                   \
761d77d6caf647424f9c1c481145be0465e96c9e3eBrian    ( ((((unsigned long) (a)) & 0xFF) << 24) | \
771d77d6caf647424f9c1c481145be0465e96c9e3eBrian      ((((unsigned long) (b)) & 0xFF) << 16) | \
781d77d6caf647424f9c1c481145be0465e96c9e3eBrian      ((((unsigned long) (c)) & 0xFF) << 8)  | \
791d77d6caf647424f9c1c481145be0465e96c9e3eBrian       (((unsigned long) (d)) & 0xFF) )
801410b7bb509ef37c41043b173bc1047257483af0Brian
811410b7bb509ef37c41043b173bc1047257483af0Brian#define PERF_FOURS(id) \
821d77d6caf647424f9c1c481145be0465e96c9e3eBrian      PERF_FOURCC((id)[0], (id)[1], (id)[2], (id)[3])
831d77d6caf647424f9c1c481145be0465e96c9e3eBrian
841d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_FOUR_CHARS(i) \
851d77d6caf647424f9c1c481145be0465e96c9e3eBrian      (char) (((i) >> 24) & 0xFF), (char) (((i) >> 16) & 0xFF), \
861d77d6caf647424f9c1c481145be0465e96c9e3eBrian      (char) (((i) >> 8)  & 0xFF), (char) ((i) & 0xFF)
8759a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul
881d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PREF(a,b) ((a) ? (a)->b : 0)
89abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca
901d77d6caf647424f9c1c481145be0465e96c9e3eBrian/*=============================================================================
911d77d6caf647424f9c1c481145be0465e96c9e3eBrian    ENUMERATIONS
921d77d6caf647424f9c1c481145be0465e96c9e3eBrian=============================================================================*/
9359a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul
94abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca/*-----------------------------------------------------------------------------
95abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BOUNDARYTYPE
96abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca
97abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    The phase of execution for the Boundary callback
98abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca-----------------------------------------------------------------------------*/
99abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonsecatypedef enum PERF_BOUNDARYTYPE
100abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca{
101abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    /* UC phase boundary type */
102abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundaryStart      = 0,
103abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundaryComplete   = 0x10000,
104abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca
105abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    /* UC phase type */
106abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundarySetup = 1,   /* UC initialization */
107abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundaryCleanup,     /* UC cleanup */
108abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundarySteadyState, /* UC is in 'steady state' - optional */
109abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca
110abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundaryMax,
111abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca    PERF_BoundaryMask   = 3,
112c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz} PERF_BOUNDARYTYPE;
113c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz
114c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz#ifdef __PERF_PRINT_C__
115c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz
116c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantzchar const * const PERF_BoundaryTypes[] = {"NONE", "Setup", "Cleanup", "Steady"};
117c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz
118c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz#endif
119c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz
120c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz#define PERF_IsComplete(x) ((x) & PERF_BoundaryComplete)
121c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz#define PERF_IsStarted(x)  (!PERF_IsComplete(x))
122c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz
123abe4f3d1aa68aec70d329447abc890b3eaaba9cbJosé Fonseca/*-----------------------------------------------------------------------------
12485206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul    PERF_MODULETYPE
12585206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul
12685206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul    Type of module when creating the component, or when specifying source
12785206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul    or destination of buffer transfers and/or commands
12885206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul-----------------------------------------------------------------------------*/
12985206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul
13085206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul/* These flags are also used for the LOG commands */
13185206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagSending     0x10000000ul   /* This is used for LOG */
13285206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagSent        0x30000000ul   /* This is used for LOG */
13385206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagRequesting  0x20000000ul   /* This is used for LOG */
13485206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagReceived    0x00000000ul   /* This is used for LOG */
13585206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagSendFlags   0x30000000ul
13685206e56a1c3400be47229d4a8c6a1cd7a2f476eBrian Paul#define PERF_FlagXfering     0x40000000ul   /* This is used for LOG */
13759a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul                                            /* = Received + Sending */
1386080e567f0ca1fdcce21e76271d4239c33a50db3Brian Paul#define PERF_FlagFrame       0x08000000ul
1396080e567f0ca1fdcce21e76271d4239c33a50db3Brian Paul#define PERF_FlagBuffer      0x00000000ul
1401d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_FlagMultiple    0x80000000ul
1411d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_FlagSingle      0x00000000ul
1421d77d6caf647424f9c1c481145be0465e96c9e3eBrian
1431d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_GetSendRecv(x) ((x) & PERF_FlagSent)
1441d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_GetXferSendRecv(x) ((x) & (PERF_FlagSendFlags | PERF_FlagXfering))
14559a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul#define PERF_GetFrameBuffer(x)     PERF_IsFrame(x)
1461d77d6caf647424f9c1c481145be0465e96c9e3eBrian#define PERF_GetMultipleSingle(x)  PERF_IsMultiple(x)
1471907135235a684872706d1a28ea8e2b4e1b6e7d3Brian Paul
14859a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul#define PERF_IsFrame(x)     ((x) & PERF_FlagFrame)
149fe2b31e4a896167a33d267822b36eb2de0ceecbaKeith Whitwell#define PERF_IsBuffer(x)    (!PERF_IsFrame(x))
150fe2b31e4a896167a33d267822b36eb2de0ceecbaKeith Whitwell#define PERF_IsSending(x)   ((x) & PERF_FlagSending)
15159a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul#define PERF_IsReceived(x)  (!PERF_IsSending(x))
1521410b7bb509ef37c41043b173bc1047257483af0Brian#define PERF_IsXfering(x)   ((x) & PERF_FlagXfering)
1531410b7bb509ef37c41043b173bc1047257483af0Brian#define PERF_IsMultiple(x)  ((x) & PERF_FlagMultiple)
15459a168d5c9b5f478e4e8bedcd8522e359e98987eBrian Paul#define PERF_IsSingle(x)    (!PERF_IsMultiple(x))
1551d77d6caf647424f9c1c481145be0465e96c9e3eBrian
156fc4cea08fe8320438c72de7f4af2d7091681dca3Keith Whitwelltypedef enum PERF_MODULETYPE
1571d77d6caf647424f9c1c481145be0465e96c9e3eBrian{
158b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleApplication,  /* application */
159763426a0256f0ab06f8af53947bd630f8600183aKeith Whitwell    PERF_ModuleSystem,       /* system components */
160763426a0256f0ab06f8af53947bd630f8600183aKeith Whitwell    PERF_ModuleService,      /* service or server */
1611279923d72942ee201fcc6ad40d552143f651f03Francisco Jerez    PERF_ModuleHLMM,         /* high-level multimedia, e.g. MMF */
1621279923d72942ee201fcc6ad40d552143f651f03Francisco Jerez    PERF_ModuleLLMM,         /* low-level multimedia, e.g. MDF, OMX */
1631279923d72942ee201fcc6ad40d552143f651f03Francisco Jerez    PERF_ModuleComponent,    /* multimedia component */
1641410b7bb509ef37c41043b173bc1047257483af0Brian    PERF_ModuleCommonLayer,  /* common layer */
165c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz    PERF_ModuleSocketNode,   /* socket-node (e.g. on DSP) */
166c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz    PERF_ModuleAlgorithm,    /* algorithm (for possible future needs) */
167c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz    PERF_ModuleHardware,     /* hardware (e.g. speaker, microphone) */
168c8c2fc9a7a029bb61520973e55fb3cec18f13e20Jakob Bornecrantz    PERF_ModuleMemory,       /* memory or unspecified modules */
1691410b7bb509ef37c41043b173bc1047257483af0Brian    PERF_ModuleMemoryMap,    /* memory mapping */
170b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleMax,
171b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleBits = 4,
172b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleMask = (1 << PERF_ModuleBits) - 1,
173b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul
174b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    /* module functional types used for selectively enabling instrumentation */
175b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleDomains     = 1 << (1 << PERF_ModuleBits),
176b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleAudioDecode = PERF_ModuleDomains,
177b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleAudioEncode = PERF_ModuleAudioDecode << 1,
178b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleVideoDecode = PERF_ModuleAudioEncode << 1,
179b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleVideoEncode = PERF_ModuleVideoDecode << 1,
180b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleImageDecode = PERF_ModuleVideoEncode << 1,
181b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    PERF_ModuleImageEncode = PERF_ModuleImageDecode << 1,
182b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul} PERF_MODULETYPE;
183b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul
184b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul#ifdef __PERF_PRINT_C__
185b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul
186e7ccd703a28e14431b90f29540cec0bf67be1e0fChristoph Bumillerchar const * const PERF_ModuleTypes[] = {
187e7ccd703a28e14431b90f29540cec0bf67be1e0fChristoph Bumiller    "Application", "System",    "Service",     "HLMM",
188e7ccd703a28e14431b90f29540cec0bf67be1e0fChristoph Bumiller    "LLMM",        "Component", "CommonLayer", "SocketNode",
189b550d8d76b42ef5ba5e8293dcc24220d5b683369Brian Paul    "Algorithm",   "Hardware",  "Memory",      "MemoryMap"
1901907135235a684872706d1a28ea8e2b4e1b6e7d3Brian Paul};
191763426a0256f0ab06f8af53947bd630f8600183aKeith Whitwell
192763426a0256f0ab06f8af53947bd630f8600183aKeith Whitwell#endif
1931410b7bb509ef37c41043b173bc1047257483af0Brian
1941410b7bb509ef37c41043b173bc1047257483af0Brian/*-----------------------------------------------------------------------------
195f7e3e46f72fffe4b83cd3f922173ff28e9ab9c7cDave Airlie    PERF_SYNCOPTYPE
196f7e3e46f72fffe4b83cd3f922173ff28e9ab9c7cDave Airlie
197f7e3e46f72fffe4b83cd3f922173ff28e9ab9c7cDave Airlie    Type of module phase of execution for the cbBoundary callback
198f7e3e46f72fffe4b83cd3f922173ff28e9ab9c7cDave Airlie-----------------------------------------------------------------------------*/
199ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheideggertypedef enum PERF_SYNCOPTYPE
200ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger{
2014ecb2c105da590abf79421a06234b636cd1afcd6Dave Airlie    PERF_SyncOpNone,
2024ecb2c105da590abf79421a06234b636cd1afcd6Dave Airlie    PERF_SyncOpDropVideoFrame,   /* drop a video frame */
2034ecb2c105da590abf79421a06234b636cd1afcd6Dave Airlie    PERF_SyncOpMax,
2044ecb2c105da590abf79421a06234b636cd1afcd6Dave Airlie} PERF_SYNCOPTYPE;
2054ecb2c105da590abf79421a06234b636cd1afcd6Dave Airlie
206ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger#ifdef __PERF_PRINT_C__
207ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger
208ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheideggerchar const *PERF_SyncOpTypes[] = {
209ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger    "none", "drop_video_frame"
2101d77d6caf647424f9c1c481145be0465e96c9e3eBrian};
211ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger
212ff5b0c72db20be099f9fc7dee22aeebbda75ab42Roland Scheidegger#endif
2131d77d6caf647424f9c1c481145be0465e96c9e3eBrian
2141d77d6caf647424f9c1c481145be0465e96c9e3eBrian/*-----------------------------------------------------------------------------
2151d77d6caf647424f9c1c481145be0465e96c9e3eBrian    PERF_COMMANDTYPE
2161d77d6caf647424f9c1c481145be0465e96c9e3eBrian
217f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell    PERF commands
218f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell-----------------------------------------------------------------------------*/
219f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwelltypedef enum PERF_COMMANDTYPE
220f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell{
221f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell    PERF_CommandMax,
222f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell    PERF_CommandStatus = 0x10000000,
223f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell} PERF_COMMANDTYPE;
224f5cca127b0ddcfe36b8dc98a5f405979e8afe673Keith Whitwell
2251d77d6caf647424f9c1c481145be0465e96c9e3eBrian#ifdef __PERF_PRINT_C__
2262253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul
2273ff688ea299581e60caf5d6e1a464f68c717fe83Zack Rusinchar const *PERF_CommandTypes[] = {
2282253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul    "none"
2292253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul};
2302253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul
2313ff688ea299581e60caf5d6e1a464f68c717fe83Zack Rusin#endif
2322253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul
2332253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul
2342253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul/*=============================================================================
2352253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul    CREATION INTERFACE
2363ff688ea299581e60caf5d6e1a464f68c717fe83Zack Rusin=============================================================================*/
2372253906da3c506bb5378a8f2fa203ed0c9021171Brian Paultypedef struct PERF_OBJTYPE *PERF_OBJHANDLE;
2382253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul
2392253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul/** PERF_Create method is the is used to create an
2401d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   instrumentation object for a component.
2411d77d6caf647424f9c1c481145be0465e96c9e3eBrian*
2421d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   NOTE: It's arguments may depend on the operating system, as
2431d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   the PERF object may need access to system resource
2441d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   (terminal, file system).  For now, we assume that all
2451d77d6caf647424f9c1c481145be0465e96c9e3eBrian*   interfaces are accessible from system calls.
246fb40c5a9c7dc91c03f80780e0a09be0cade98705Brian*
247fb40c5a9c7dc91c03f80780e0a09be0cade98705Brian*   This operation may include allocating resources from the
248fb40c5a9c7dc91c03f80780e0a09be0cade98705Brian*   system, to create any structures required for managing the
2492253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   data collected during instrumentation, but our aim is to
2502253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   have these resources be minimal.
2512253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*
2522253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   Most options are run-tempTime configurable.  See perf_config.h
2532253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   for such options.
2542253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*
2552253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   In case of error - or if performance instrumentation is
2562253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   run-tempTime disabled, PERF_Create will return a NULL handle,
2572253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   and all resource allocations will be undone.
2582253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*
2592253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   @param ulComponent
2602253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*       FourCC component ID.
2612253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   @param eModule
2622253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*       ModuleType.
2632253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*   @return hObject
2642253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul*       Handle to the instrumentation object.
2652253906da3c506bb5378a8f2fa203ed0c9021171Brian Paul */
2661d77d6caf647424f9c1c481145be0465e96c9e3eBrian
2671d77d6caf647424f9c1c481145be0465e96c9e3eBrianPERF_OBJHANDLE PERF_Create(
2688223add3304451d5e75737a6d1be1739e4517943Brian Paul                          unsigned long ulComponentName,
2698223add3304451d5e75737a6d1be1739e4517943Brian Paul                          PERF_MODULETYPE eModule);
2708223add3304451d5e75737a6d1be1739e4517943Brian Paul
2718223add3304451d5e75737a6d1be1739e4517943Brian Paul/** The PERF_Done method is called at the end of the component
2728223add3304451d5e75737a6d1be1739e4517943Brian Paul*   life cycle.
2738223add3304451d5e75737a6d1be1739e4517943Brian Paul*   @param hObject
2748223add3304451d5e75737a6d1be1739e4517943Brian Paul*       Handle to the PERF object.  This must be an lvalue, as
2758223add3304451d5e75737a6d1be1739e4517943Brian Paul*       it will be deleted and set to NULL upon return.
2768223add3304451d5e75737a6d1be1739e4517943Brian Paul* */
2778223add3304451d5e75737a6d1be1739e4517943Brian Paul#define PERF_Done(           \
2788223add3304451d5e75737a6d1be1739e4517943Brian Paul        hObject)             \
2798223add3304451d5e75737a6d1be1739e4517943Brian Paul    do {                     \
2808223add3304451d5e75737a6d1be1739e4517943Brian Paul    __PERF_Location(hObject) \
2818223add3304451d5e75737a6d1be1739e4517943Brian Paul    __PERF_Done(hObject);    \
2828223add3304451d5e75737a6d1be1739e4517943Brian Paul    } while (0)
2838223add3304451d5e75737a6d1be1739e4517943Brian Paul
2848223add3304451d5e75737a6d1be1739e4517943Brian Paul
2858223add3304451d5e75737a6d1be1739e4517943Brian Paul/*=============================================================================
2868223add3304451d5e75737a6d1be1739e4517943Brian Paul    INSTRUMENTATION INTERFACE
2878223add3304451d5e75737a6d1be1739e4517943Brian Paul=============================================================================*/
2888223add3304451d5e75737a6d1be1739e4517943Brian Paul
2898223add3304451d5e75737a6d1be1739e4517943Brian Paul/** The PERF_Boundary callback must be called by the component
2908223add3304451d5e75737a6d1be1739e4517943Brian Paul*   at specific phases of the component.
2918223add3304451d5e75737a6d1be1739e4517943Brian Paul*   @param hObject
2928223add3304451d5e75737a6d1be1739e4517943Brian Paul*       Handle to the PERF object.
2938223add3304451d5e75737a6d1be1739e4517943Brian Paul*   @param eBoundary
2948223add3304451d5e75737a6d1be1739e4517943Brian Paul*       Boundary (phase) that is reached by the application.
2958223add3304451d5e75737a6d1be1739e4517943Brian Paul* */
2968223add3304451d5e75737a6d1be1739e4517943Brian Paul
2978223add3304451d5e75737a6d1be1739e4517943Brian Paul#define PERF_Boundary(       \
2988223add3304451d5e75737a6d1be1739e4517943Brian Paul        hObject,             \
2998223add3304451d5e75737a6d1be1739e4517943Brian Paul        eBoundary)           \
3008223add3304451d5e75737a6d1be1739e4517943Brian Paul    do {                     \
3018223add3304451d5e75737a6d1be1739e4517943Brian Paul    __PERF_Location(hObject) \
3027d6c8f980d1e23ad6f557d650e89c715861a3b0cKeith Whitwell    __PERF_FN(Boundary)(hObject, eBoundary); \
3038223add3304451d5e75737a6d1be1739e4517943Brian Paul    } while (0)
3047d6c8f980d1e23ad6f557d650e89c715861a3b0cKeith Whitwell
3058223add3304451d5e75737a6d1be1739e4517943Brian Paul/** The PERF_SendingBuffer(s) and PERF_SendingFrame(s) method is
3068223add3304451d5e75737a6d1be1739e4517943Brian Paul*   used to mark when a buffer (or frame) is to be sent to
3078223add3304451d5e75737a6d1be1739e4517943Brian Paul*   another module.
3084a531fb46a6ab544666c5eeb362f3622bd44aaffAlan Hourihane*
3094a531fb46a6ab544666c5eeb362f3622bd44aaffAlan Hourihane*   @param hObject
3105b0824dfe5eaf59fa87134e7482b3d147b262901Keith Whitwell*       Handle to the PERF object.
31191a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell*   @param ulAddress or ulAddress1 and ulAddress2
3128223add3304451d5e75737a6d1be1739e4517943Brian Paul*       Buffer (or frame) address(es).
31391a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell*   @param ulSize
31491a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell*       size of buffer(s) that is sent regardless if it is sent
3158223add3304451d5e75737a6d1be1739e4517943Brian Paul*       by pointer exchange or memory copy.
31691a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell*   @param eModuleTo
31791a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell*       Type of module that is receiving the data.
31891a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell* */
31991a4e6d53f83c45c1da9240b6325011d96b61386Keith Whitwell#define PERF_SendingBuffer(                                             \
3208223add3304451d5e75737a6d1be1739e4517943Brian Paul        hObject,                                                        \
3215b0824dfe5eaf59fa87134e7482b3d147b262901Keith Whitwell        ulAddress,                                                      \
3228223add3304451d5e75737a6d1be1739e4517943Brian Paul        ulSize,                                                         \
3238223add3304451d5e75737a6d1be1739e4517943Brian Paul        eModuleTo)                                                      \
3248223add3304451d5e75737a6d1be1739e4517943Brian Paul  do {                                                                  \
3258223add3304451d5e75737a6d1be1739e4517943Brian Paul  __PERF_Location(hObject)                                              \
3268223add3304451d5e75737a6d1be1739e4517943Brian Paul  __PERF_FN(Buffer)(hObject,                                            \
3278223add3304451d5e75737a6d1be1739e4517943Brian Paul                    PERF_FlagSending, PERF_FlagSingle, PERF_FlagBuffer, \
3288223add3304451d5e75737a6d1be1739e4517943Brian Paul                    ulAddress, NULL, ulSize, eModuleTo, 0);             \
3298223add3304451d5e75737a6d1be1739e4517943Brian Paul  } while(0)
3308223add3304451d5e75737a6d1be1739e4517943Brian Paul
3318223add3304451d5e75737a6d1be1739e4517943Brian Paul#define PERF_SendingFrame(                                             \
3328223add3304451d5e75737a6d1be1739e4517943Brian Paul        hObject,                                                       \
3333ff688ea299581e60caf5d6e1a464f68c717fe83Zack Rusin        ulAddress,                                                     \
3343ff688ea299581e60caf5d6e1a464f68c717fe83Zack Rusin        ulSize,                                                        \
3358223add3304451d5e75737a6d1be1739e4517943Brian Paul        eModuleTo)                                                     \
3368223add3304451d5e75737a6d1be1739e4517943Brian Paul  do {                                                                 \
3378223add3304451d5e75737a6d1be1739e4517943Brian Paul  __PERF_Location(hObject)                                             \
3388223add3304451d5e75737a6d1be1739e4517943Brian Paul  __PERF_FN(Buffer)(hObject,                                           \
3398223add3304451d5e75737a6d1be1739e4517943Brian Paul                    PERF_FlagSending, PERF_FlagSingle, PERF_FlagFrame, \
3408223add3304451d5e75737a6d1be1739e4517943Brian Paul                    ulAddress, NULL, ulSize, eModuleTo, 0);            \
3418223add3304451d5e75737a6d1be1739e4517943Brian Paul  } while (0)
3428223add3304451d5e75737a6d1be1739e4517943Brian Paul
3438223add3304451d5e75737a6d1be1739e4517943Brian Paul#define PERF_SendingBuffers(                                              \
3448223add3304451d5e75737a6d1be1739e4517943Brian Paul        hObject,                                                          \
345        ulAddress1,                                                       \
346        ulAddress2,                                                       \
347        ulSize,                                                           \
348        eModuleTo)                                                        \
349  do {                                                                    \
350  __PERF_Location(hObject)                                                \
351  __PERF_FN(Buffer)(hObject,                                              \
352                    PERF_FlagSending, PERF_FlagMultiple, PERF_FlagBuffer, \
353                    ulAddress1, ulAddress2, ulSize, eModuleTo, 0);        \
354  } while (0)
355
356#define PERF_SendingFrames(                                              \
357        hObject,                                                         \
358        ulAddress1,                                                      \
359        ulAddress2,                                                      \
360        ulSize,                                                          \
361        eModuleTo)                                                       \
362  do {                                                                   \
363  __PERF_Location(hObject)                                               \
364  __PERF_FN(Buffer)(hObject,                                             \
365                    PERF_FlagSending, PERF_FlagMultiple, PERF_FlagFrame, \
366                    ulAddress1, ulAddress2, ulSize, eModuleTo, 0);       \
367  } while (0)
368
369/** The PERF_SendingCommand method is used to mark when a
370*   command is to be sent to another module.
371*
372*   @param hObject
373*       Handle to the PERF object.
374*   @param ulCommand
375*       Command.
376*   @param eModuleTo
377*       Type of module that is receiving the data.
378* */
379#define PERF_SendingCommand(  \
380        hObject,              \
381        ulCommand,            \
382        ulArgument,           \
383        eModuleTo)            \
384  do {                        \
385  __PERF_Location(hObject)    \
386  __PERF_FN(Command)(hObject, \
387                     PERF_FlagSending, ulCommand, ulArgument, eModuleTo); \
388  } while (0)
389
390/** The PERF_SentBuffer(s) and PERF_SentFrame(s) method is
391*   used to mark when a buffer (or frame) has been sent to
392*   another module.
393*
394*   @param hObject
395*       Handle to the PERF object.
396*   @param ulAddress or ulAddress1 and ulAddress2
397*       Buffer (or frame) address(es).
398*   @param ulSize
399*       size of buffer(s) that is sent regardless if it is sent
400*       by pointer exchange or memory copy.
401*   @param eModuleTo
402*       Type of module that is receiving the data.
403* */
404#define PERF_SentBuffer(                                             \
405        hObject,                                                     \
406        ulAddress,                                                   \
407        ulSize,                                                      \
408        eModuleTo)                                                   \
409  do {                                                               \
410  __PERF_Location(hObject)                                           \
411  __PERF_FN(Buffer)(hObject,                                         \
412                    PERF_FlagSent, PERF_FlagSingle, PERF_FlagBuffer, \
413                    ulAddress, NULL, ulSize, eModuleTo, 0);          \
414  } while(0)
415
416#define PERF_SentFrame(                                             \
417        hObject,                                                    \
418        ulAddress,                                                  \
419        ulSize,                                                     \
420        eModuleTo)                                                  \
421  do {                                                              \
422  __PERF_Location(hObject)                                          \
423  __PERF_FN(Buffer)(hObject,                                        \
424                    PERF_FlagSent, PERF_FlagSingle, PERF_FlagFrame, \
425                    ulAddress, NULL, ulSize, eModuleTo, 0);         \
426  } while (0)
427
428#define PERF_SentBuffers(                                              \
429        hObject,                                                       \
430        ulAddress1,                                                    \
431        ulAddress2,                                                    \
432        ulSize,                                                        \
433        eModuleTo)                                                     \
434  do {                                                                 \
435  __PERF_Location(hObject)                                             \
436  __PERF_FN(Buffer)(hObject,                                           \
437                    PERF_FlagSent, PERF_FlagMultiple, PERF_FlagBuffer, \
438                    ulAddress1, ulAddress2, ulSize, eModuleTo, 0);     \
439  } while (0)
440
441#define PERF_SentFrames(                                              \
442        hObject,                                                      \
443        ulAddress1,                                                   \
444        ulAddress2,                                                   \
445        ulSize,                                                       \
446        eModuleTo)                                                    \
447  do {                                                                \
448  __PERF_Location(hObject)                                            \
449  __PERF_FN(Buffer)(hObject,                                          \
450                    PERF_FlagSent, PERF_FlagMultiple, PERF_FlagFrame, \
451                    ulAddress1, ulAddress2, ulSize, eModuleTo, 0);    \
452  } while (0)
453
454/** The PERF_SentCommand method is used to mark when a
455*   command has been sent to another module.
456*
457*   @param hObject
458*       Handle to the PERF object.
459*   @param ulCommand
460*       Command.
461*   @param eModuleTo
462*       Type of module that is receiving the data.
463* */
464#define PERF_SentCommand(     \
465        hObject,              \
466        ulCommand,            \
467        ulArgument,           \
468        eModuleTo)            \
469  do {                        \
470  __PERF_Location(hObject)    \
471  __PERF_FN(Command)(hObject, \
472                     PERF_FlagSent, ulCommand, ulArgument, eModuleTo); \
473  } while (0)
474
475/** The PERF_RequestingBuffer(s) and PERF_RequestingFrame(s) method
476*   is used to mark when a buffer (or frame) is beeing requested
477*   from another module. These go hand-in-hand with
478*   ReceivedBuffer and ReceivedFrame, if one wants to measure
479*   the time spent waiting (pending) for a buffer/frame.  Note,
480*   that the buffer address or size may not be known upon
481*   calling this method, in which case -1 should be used.
482*   @param hAPI
483*       Handle to the PERF object.
484*   @param ulAddress
485*       Buffer (or frame) address.
486*   @param ulSize
487*       size of buffer(s) that is sent regardless if it is sent
488*       by pointer exchange or memory copy.
489*   @param eModuleFrom
490*       Type of module that is sending the data.
491* */
492#define PERF_RequestingBuffer(                                             \
493        hObject,                                                           \
494        ulAddress,                                                         \
495        ulSize,                                                            \
496        eModuleFrom)                                                       \
497  do {                                                                     \
498  __PERF_Location(hObject)                                                 \
499  __PERF_FN(Buffer)(hObject,                                               \
500                    PERF_FlagRequesting, PERF_FlagSingle, PERF_FlagBuffer, \
501                    ulAddress, NULL, ulSize, eModuleFrom, 0);              \
502  } while (0)
503
504#define PERF_RequestingFrame(                                             \
505        hObject,                                                          \
506        ulAddress,                                                        \
507        ulSize,                                                           \
508        eModuleFrom)                                                      \
509  do {                                                                    \
510  __PERF_Location(hObject)                                                \
511  __PERF_FN(Buffer)(hObject,                                              \
512                    PERF_FlagRequesting, PERF_FlagSingle, PERF_FlagFrame, \
513                    ulAddress, NULL, ulSize, eModuleFrom, 0);             \
514  } while (0)
515
516#define PERF_RequestingBuffers(                                              \
517        hObject,                                                             \
518        ulAddress1,                                                          \
519        ulAddress2,                                                          \
520        ulSize,                                                              \
521        eModuleFrom)                                                         \
522  do {                                                                       \
523  __PERF_Location(hObject)                                                   \
524  __PERF_FN(Buffer)(hObject,                                                 \
525                    PERF_FlagRequesting, PERF_FlagMultiple, PERF_FlagBuffer, \
526                    ulAddress1, ulAddress2, ulSize, eModuleFrom, 0);         \
527  } while (0)
528
529#define PERF_RequestingFrames(                                              \
530        hObject,                                                            \
531        ulAddress1,                                                         \
532        ulAddress2,                                                         \
533        ulSize,                                                             \
534        eModuleFrom)                                                        \
535  do {                                                                      \
536  __PERF_Location(hObject)                                                  \
537  __PERF_FN(Buffer)(hObject,                                                \
538                    PERF_FlagRequesting, PERF_FlagMultiple, PERF_FlagFrame, \
539                    ulAddress1, ulAddress2, ulSize, eModuleFrom, 0);        \
540  } while (0)
541
542/** The PERF_RequestingCommand method is used to mark when a
543*   command is being requested from another module.  This method
544*   goes in hand with the PERF_ReceivedCommand to measure the
545*   time the application is "pending" for the command.  Note,
546*   that the command is most likely not known when calling this
547*   method, in which case -1 should be used.
548*
549*   @param hObject
550*       Handle to the PERF object.
551*   @param ulCommand
552*       Command.
553*   @param eModuleTo
554*       Type of module that sent the data.
555* */
556#define PERF_RequestingCommand( \
557        hObject,                \
558        ulCommand,              \
559		ulArgument,             \
560        eModuleFrom)            \
561  do {                          \
562  __PERF_Location(hObject)      \
563  __PERF_FN(Command)(hObject,   \
564                     PERF_FlagRequesting, ulCommand, ulArgument, eModuleFrom); \
565  } while (0)
566
567
568/** The PERF_ReceivedBuffer(s) and PERF_ReceivedFrame(s) method
569*   is used to mark when a buffer (or frame) is received from
570*   another module. These go hand-in-hand with SendingBuffer and
571*   SendingFrame, if instrumentation is implemented at all
572*   module boundaries.
573*   @param hAPI
574*       Handle to the PERF object.
575*   @param ulAddress
576*       Buffer (or frame) address.
577*   @param ulSize
578*       size of buffer(s) that is sent regardless if it is sent
579*       by pointer exchange or memory copy.
580*   @param eModuleFrom
581*       Type of module that is sending the data.
582* */
583#define PERF_ReceivedBuffer(                                             \
584        hObject,                                                         \
585        ulAddress,                                                       \
586        ulSize,                                                          \
587        eModuleFrom)                                                     \
588  do {                                                                   \
589  __PERF_Location(hObject)                                               \
590  __PERF_FN(Buffer)(hObject,                                             \
591                    PERF_FlagReceived, PERF_FlagSingle, PERF_FlagBuffer, \
592                    ulAddress, NULL, ulSize, eModuleFrom, 0);            \
593  } while (0)
594
595#define PERF_ReceivedFrame(                                             \
596        hObject,                                                        \
597        ulAddress,                                                      \
598        ulSize,                                                         \
599        eModuleFrom)                                                    \
600  do {                                                                  \
601  __PERF_Location(hObject)                                              \
602  __PERF_FN(Buffer)(hObject,                                            \
603                    PERF_FlagReceived, PERF_FlagSingle, PERF_FlagFrame, \
604                    ulAddress, NULL, ulSize, eModuleFrom, 0);           \
605  } while (0)
606
607#define PERF_ReceivedBuffers(                                              \
608        hObject,                                                           \
609        ulAddress1,                                                        \
610        ulAddress2,                                                        \
611        ulSize,                                                            \
612        eModuleFrom)                                                       \
613  do {                                                                     \
614  __PERF_Location(hObject)                                                 \
615  __PERF_FN(Buffer)(hObject,                                               \
616                    PERF_FlagReceived, PERF_FlagMultiple, PERF_FlagBuffer, \
617                    ulAddress1, ulAddress2, ulSize, eModuleFrom, 0);       \
618  } while (0)
619
620#define PERF_ReceivedFrames(                                              \
621        hObject,                                                          \
622        ulAddress1,                                                       \
623        ulAddress2,                                                       \
624        ulSize,                                                           \
625        eModuleFrom)                                                      \
626  do {                                                                    \
627  __PERF_Location(hObject)                                                \
628  __PERF_FN(Buffer)(hObject,                                              \
629                    PERF_FlagReceived, PERF_FlagMultiple, PERF_FlagFrame, \
630                    ulAddress1, ulAddress2, ulSize, eModuleFrom, 0);      \
631  } while (0)
632
633/** The PERF_ReceivedCommand method is used to mark when a
634*   command is received from another module.
635*
636*   @param hObject
637*       Handle to the PERF object.
638*   @param ulCommand
639*       Command.
640*   @param eModuleTo
641*       Type of module that sent the data.
642* */
643#define PERF_ReceivedCommand( \
644        hObject,              \
645        ulCommand,            \
646		ulArgument,           \
647        eModuleFrom)          \
648  do {                        \
649  __PERF_Location(hObject)    \
650  __PERF_FN(Command)(hObject, \
651                     PERF_FlagReceived, ulCommand, ulArgument, eModuleFrom); \
652  } while (0)
653
654/** The PERF_XferingBuffer(s) and PERF_XferingFrame(s)
655*   method is used to mark when a buffer (or frame) is to be
656*   transferred from one module to another.  This is shortcut
657*   for PERF_Received followed by PERF_Sending
658*
659*   @param hObject
660*       Handle to the PERF object.
661*   @param ulAddress or ulAddress1 and ulAddress2
662*       Buffer (or frame) address(es).
663*   @param ulSize
664*       size of buffer(s) that is sent regardless if it is sent
665*       by pointer exchange or memory copy.
666*   @param eModuleFrom
667*       Type of module that is sending the data.
668*   @param eModuleTo
669*       Type of module that is receiving the data.
670* */
671#define PERF_XferingBuffer(                                             \
672        hObject,                                                        \
673        ulAddress,                                                      \
674        ulSize,                                                         \
675        eModuleFrom,                                                    \
676        eModuleTo)                                                      \
677  do {                                                                  \
678  __PERF_Location(hObject)                                              \
679  __PERF_FN(Buffer)(hObject,                                            \
680                    PERF_FlagXfering, PERF_FlagSingle, PERF_FlagBuffer, \
681                    ulAddress, NULL, ulSize, eModuleFrom, eModuleTo);   \
682  } while (0)
683
684#define PERF_XferingFrame(                                             \
685        hObject,                                                       \
686        ulAddress,                                                     \
687        ulSize,                                                        \
688        eModuleFrom,                                                   \
689        eModuleTo)                                                     \
690  do {                                                                 \
691  __PERF_Location(hObject)                                             \
692  __PERF_FN(Buffer)(hObject,                                           \
693                    PERF_FlagXfering, PERF_FlagSingle, PERF_FlagFrame, \
694                    ulAddress, NULL, ulSize, eModuleFrom, eModuleTo);  \
695  } while (0)
696
697#define PERF_XferingBuffers(                                              \
698        hObject,                                                          \
699        ulAddress1,                                                       \
700        ulAddress2,                                                       \
701        ulSize,                                                           \
702        eModuleFrom,                                                      \
703        eModuleTo)                                                        \
704  do {                                                                    \
705  __PERF_Location(hObject)                                                \
706  __PERF_FN(Buffer)(hObject,                                              \
707                    PERF_FlagXfering, PERF_FlagMultiple, PERF_FlagBuffer, \
708                    ulAddress1, ulAddress2, ulSize, eModuleFrom, eModuleTo);\
709  } while (0)
710
711#define PERF_XferingFrames(                                              \
712        hObject,                                                         \
713        ulAddress1,                                                      \
714        ulAddress2,                                                      \
715        ulSize,                                                          \
716        eModuleFrom,                                                     \
717        eModuleTo)                                                       \
718  do {                                                                   \
719  __PERF_Location(hObject)                                               \
720  __PERF_FN(Buffer)(hObject,                                             \
721                    PERF_FlagXfering, PERF_FlagMultiple, PERF_FlagFrame, \
722                    ulAddress1, ulAddress2, ulSize, eModuleFrom, eModuleTo);\
723  } while (0)
724
725/** The PERF_SyncData method shall be called by a module that
726*   synchronizes audio/video streams.  It informs the
727*   instrumentation module about the tempTime stamps of the two
728*   streams, as well as the operation (if any) to restore
729*   synchronization.
730*   @param hObject
731*       Handle to the PERF object.
732*   @param pfTimeAudio
733*       Time stamp of audio frame
734*   @param pfTimeVideo
735*       Time stamp of video frame
736*   @param eSyncOperation
737*       Synchronization operation that is being taken to get
738*       streams in sync.
739* */
740#define PERF_SyncAV(       \
741        hObject,           \
742        fTimeAudio,        \
743        fTimeVideo,        \
744        eSyncOperation)    \
745  do {                     \
746  __PERF_Location(hObject) \
747    __PERF_FN(SyncAV)(hObject, fTimeAudio, fTimeVideo, eSyncOperation); \
748  } while (0)
749
750/** The PERF_TheadCreated method shall be called after creating
751*   a new thread.
752*   @param hObject
753*       Handle to the PERF object.
754*   @param pfTimeAudio
755*       Time stamp of audio frame
756*   @param pfTimeVideo
757*       Time stamp of video frame
758*   @param eSyncOperation
759*       Synchronization operation that is being taken to get
760*       streams in sync.
761* */
762#define PERF_ThreadCreated( \
763        hObject,            \
764        ulThreadID,         \
765        ulThreadName)       \
766  do {                      \
767  __PERF_Location(hObject)  \
768    __PERF_FN(ThreadCreated)(hObject, ulThreadID, ulThreadName); \
769  }  while (0)
770
771/** The PERF_Log method can be called to log 3 values into the
772*   log.  The 1st argument is capped at 28 bits.
773*   @param hObject
774*       Handle to the PERF object.
775*   @param ulData1, ulData2, ulData3
776*       Data to be logged
777* */
778#define PERF_Log( \
779        hObject,  \
780        ulData1,  \
781        ulData2,  \
782        ulData3)  \
783  do {            \
784  __PERF_Location(hObject) \
785    __PERF_FN(Log)(hObject, ulData1, ulData2, ulData3);\
786  } while (0)
787
788/* define PERF_OBJ and the used __PERF macros */
789#include "perf_obj.h"
790
791#endif /* __PERF_INSTURMENTATION__ */
792
793#endif /* __PERF_H__ */
794
795
796