mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
Merge pull request #8766 from alalek:trace
This commit is contained in:
commit
b500ae2d21
68
3rdparty/ittnotify/CMakeLists.txt
vendored
Normal file
68
3rdparty/ittnotify/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for Intel ITT API. See root CMakeLists.txt
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if(NOT ITT_LIBRARY)
|
||||
set(ITT_LIBRARY "ittnotify")
|
||||
endif()
|
||||
project(${ITT_LIBRARY} C)
|
||||
|
||||
if(NOT WIN32)
|
||||
include(CheckLibraryExists)
|
||||
if(COMMAND CHECK_LIBRARY_EXISTS)
|
||||
CHECK_LIBRARY_EXISTS(dl dlerror "" HAVE_DL_LIBRARY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
set(ITT_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
set(ITT_PUBLIC_HDRS
|
||||
include/ittnotify.h
|
||||
include/jitprofiling.h
|
||||
include/libittnotify.h
|
||||
include/llvm_jit_event_listener.hpp
|
||||
)
|
||||
set(ITT_PRIVATE_HDRS
|
||||
src/ittnotify/disable_warnings.h
|
||||
src/ittnotify/ittnotify_config.h
|
||||
src/ittnotify/ittnotify_static.h
|
||||
src/ittnotify/ittnotify_types.h
|
||||
)
|
||||
set(ITT_SRCS
|
||||
src/ittnotify/ittnotify_static.c
|
||||
src/ittnotify/jitprofiling.c
|
||||
)
|
||||
|
||||
add_library(${ITT_LIBRARY} STATIC ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PRIVATE_HDRS})
|
||||
|
||||
if(NOT WIN32)
|
||||
if(HAVE_DL_LIBRARY)
|
||||
target_link_libraries(${ITT_LIBRARY} dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(${ITT_LIBRARY} PROPERTIES
|
||||
OUTPUT_NAME ${ITT_LIBRARY}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${ITT_LIBRARY}
|
||||
COMPILE_PDB_NAME_DEBUG "${ITT_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wsign-compare)
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${ITT_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${ITT_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
4123
3rdparty/ittnotify/include/ittnotify.h
vendored
Normal file
4123
3rdparty/ittnotify/include/ittnotify.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
694
3rdparty/ittnotify/include/jitprofiling.h
vendored
Normal file
694
3rdparty/ittnotify/include/jitprofiling.h
vendored
Normal file
@ -0,0 +1,694 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#ifndef __JITPROFILING_H__
|
||||
#define __JITPROFILING_H__
|
||||
|
||||
/**
|
||||
* @brief JIT Profiling APIs
|
||||
*
|
||||
* The JIT Profiling API is used to report information about just-in-time
|
||||
* generated code that can be used by performance tools. The user inserts
|
||||
* calls in the code generator to report information before JIT-compiled
|
||||
* code goes to execution. This information is collected at runtime and used
|
||||
* by tools like Intel(R) VTune(TM) Amplifier to display performance metrics
|
||||
* associated with JIT-compiled code.
|
||||
*
|
||||
* These APIs can be used to\n
|
||||
* - **Profile trace-based and method-based JIT-compiled
|
||||
* code**. Some examples of environments that you can profile with these APIs:
|
||||
* dynamic JIT compilation of JavaScript code traces, JIT execution in OpenCL(TM)
|
||||
* software technology, Java/.NET managed execution environments, and custom
|
||||
* ISV JIT engines.
|
||||
* @code
|
||||
* #include <jitprofiling.h>
|
||||
*
|
||||
* if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) {
|
||||
* return;
|
||||
* }
|
||||
*
|
||||
* iJIT_Method_Load jmethod = {0};
|
||||
* jmethod.method_id = iJIT_GetNewMethodID();
|
||||
* jmethod.method_name = "method_name";
|
||||
* jmethod.class_file_name = "class_name";
|
||||
* jmethod.source_file_name = "source_file_name";
|
||||
* jmethod.method_load_address = code_addr;
|
||||
* jmethod.method_size = code_size;
|
||||
*
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL);
|
||||
* @endcode
|
||||
*
|
||||
* * Expected behavior:
|
||||
* * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
|
||||
* already reported method, then such a method becomes invalid and its
|
||||
* memory region is treated as unloaded. VTune Amplifier displays the metrics
|
||||
* collected by the method until it is overwritten.
|
||||
* * If supplied line number information contains multiple source lines for
|
||||
* the same assembly instruction (code location), then VTune Amplifier picks up
|
||||
* the first line number.
|
||||
* * Dynamically generated code can be associated with a module name.
|
||||
* Use the iJIT_Method_Load_V2 structure.\n
|
||||
* Clarification of some cases:
|
||||
* * If you register a function with the same method ID multiple times,
|
||||
* specifying different module names, then the VTune Amplifier picks up
|
||||
* the module name registered first. If you want to distinguish the same
|
||||
* function between different JIT engines, supply different method IDs for
|
||||
* each function. Other symbolic information (for example, source file)
|
||||
* can be identical.
|
||||
*
|
||||
* - **Analyze split functions** (multiple joint or disjoint code regions
|
||||
* belonging to the same function) **including re-JIT**
|
||||
* with potential overlapping of code regions in time, which is common in
|
||||
* resource-limited environments.
|
||||
* @code
|
||||
* #include <jitprofiling.h>
|
||||
*
|
||||
* unsigned int method_id = iJIT_GetNewMethodID();
|
||||
*
|
||||
* iJIT_Method_Load a = {0};
|
||||
* a.method_id = method_id;
|
||||
* a.method_load_address = 0x100;
|
||||
* a.method_size = 0x20;
|
||||
*
|
||||
* iJIT_Method_Load b = {0};
|
||||
* b.method_id = method_id;
|
||||
* b.method_load_address = 0x200;
|
||||
* b.method_size = 0x30;
|
||||
*
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b);
|
||||
* @endcode
|
||||
*
|
||||
* * Expected behaviour:
|
||||
* * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
|
||||
* already reported method, then such a method becomes invalid and
|
||||
* its memory region is treated as unloaded.
|
||||
* * All code regions reported with the same method ID are considered as
|
||||
* belonging to the same method. Symbolic information (method name,
|
||||
* source file name) will be taken from the first notification, and all
|
||||
* subsequent notifications with the same method ID will be processed
|
||||
* only for line number table information. So, the VTune Amplifier will map
|
||||
* samples to a source line using the line number table from the current
|
||||
* notification while taking the source file name from the very first one.\n
|
||||
* Clarification of some cases:\n
|
||||
* * If you register a second code region with a different source file
|
||||
* name and the same method ID, then this information will be saved and
|
||||
* will not be considered as an extension of the first code region, but
|
||||
* VTune Amplifier will use the source file of the first code region and map
|
||||
* performance metrics incorrectly.
|
||||
* * If you register a second code region with the same source file as
|
||||
* for the first region and the same method ID, then the source file will be
|
||||
* discarded but VTune Amplifier will map metrics to the source file correctly.
|
||||
* * If you register a second code region with a null source file and
|
||||
* the same method ID, then provided line number info will be associated
|
||||
* with the source file of the first code region.
|
||||
*
|
||||
* - **Explore inline functions** including multi-level hierarchy of
|
||||
* nested inline methods which shows how performance metrics are distributed through them.
|
||||
* @code
|
||||
* #include <jitprofiling.h>
|
||||
*
|
||||
* // method_id parent_id
|
||||
* // [-- c --] 3000 2000
|
||||
* // [---- d -----] 2001 1000
|
||||
* // [---- b ----] 2000 1000
|
||||
* // [------------ a ----------------] 1000 n/a
|
||||
*
|
||||
* iJIT_Method_Load a = {0};
|
||||
* a.method_id = 1000;
|
||||
*
|
||||
* iJIT_Method_Inline_Load b = {0};
|
||||
* b.method_id = 2000;
|
||||
* b.parent_method_id = 1000;
|
||||
*
|
||||
* iJIT_Method_Inline_Load c = {0};
|
||||
* c.method_id = 3000;
|
||||
* c.parent_method_id = 2000;
|
||||
*
|
||||
* iJIT_Method_Inline_Load d = {0};
|
||||
* d.method_id = 2001;
|
||||
* d.parent_method_id = 1000;
|
||||
*
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b);
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c);
|
||||
* iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d);
|
||||
* @endcode
|
||||
*
|
||||
* * Requirements:
|
||||
* * Each inline (iJIT_Method_Inline_Load) method should be associated
|
||||
* with two method IDs: one for itself; one for its immediate parent.
|
||||
* * Address regions of inline methods of the same parent method cannot
|
||||
* overlap each other.
|
||||
* * Execution of the parent method must not be started until it and all
|
||||
* its inline methods are reported.
|
||||
* * Expected behaviour:
|
||||
* * In case of nested inline methods an order of
|
||||
* iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important.
|
||||
* * If any event overwrites either inline method or top parent method,
|
||||
* then the parent, including inline methods, becomes invalid and its memory
|
||||
* region is treated as unloaded.
|
||||
*
|
||||
* **Life time of allocated data**\n
|
||||
* The client sends an event notification to the agent with event-specific
|
||||
* data, which is a structure. The pointers in the structure refer to memory
|
||||
* allocated by the client, which responsible for releasing it. The pointers are
|
||||
* used by the iJIT_NotifyEvent method to copy client's data in a trace file,
|
||||
* and they are not used after the iJIT_NotifyEvent method returns.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup jitapi JIT Profiling
|
||||
* @ingroup internal
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enumerator for the types of notifications
|
||||
*/
|
||||
typedef enum iJIT_jvm_event
|
||||
{
|
||||
iJVM_EVENT_TYPE_SHUTDOWN = 2, /**<\brief Send this to shutdown the agent.
|
||||
* Use NULL for event data. */
|
||||
|
||||
iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**<\brief Send when dynamic code is
|
||||
* JIT compiled and loaded into
|
||||
* memory by the JIT engine, but
|
||||
* before the code is executed.
|
||||
* Use iJIT_Method_Load as event
|
||||
* data. */
|
||||
/** @cond exclude_from_documentation */
|
||||
iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**<\brief Send when compiled dynamic
|
||||
* code is being unloaded from memory.
|
||||
* Use iJIT_Method_Load as event data.*/
|
||||
/** @endcond */
|
||||
|
||||
iJVM_EVENT_TYPE_METHOD_UPDATE, /**<\brief Send to provide new content for
|
||||
* a previously reported dynamic code.
|
||||
* The previous content will be invalidated
|
||||
* starting from the time of the notification.
|
||||
* Use iJIT_Method_Load as event data but
|
||||
* required fields are following:
|
||||
* - method_id identify the code to update.
|
||||
* - method_load_address specify start address
|
||||
* within identified code range
|
||||
* where update should be started.
|
||||
* - method_size specify length of updated code
|
||||
* range. */
|
||||
|
||||
|
||||
iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**<\brief Send when an inline dynamic
|
||||
* code is JIT compiled and loaded
|
||||
* into memory by the JIT engine,
|
||||
* but before the parent code region
|
||||
* starts executing.
|
||||
* Use iJIT_Method_Inline_Load as event data.*/
|
||||
|
||||
/** @cond exclude_from_documentation */
|
||||
iJVM_EVENT_TYPE_METHOD_UPDATE_V2,
|
||||
/** @endcond */
|
||||
|
||||
iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 = 21, /**<\brief Send when a dynamic code is
|
||||
* JIT compiled and loaded into
|
||||
* memory by the JIT engine, but
|
||||
* before the code is executed.
|
||||
* Use iJIT_Method_Load_V2 as event data. */
|
||||
|
||||
iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 /**<\brief Send when a dynamic code is
|
||||
* JIT compiled and loaded into
|
||||
* memory by the JIT engine, but
|
||||
* before the code is executed.
|
||||
* Use iJIT_Method_Load_V3 as event data. */
|
||||
} iJIT_JVM_EVENT;
|
||||
|
||||
/**
|
||||
* @brief Enumerator for the agent's mode
|
||||
*/
|
||||
typedef enum _iJIT_IsProfilingActiveFlags
|
||||
{
|
||||
iJIT_NOTHING_RUNNING = 0x0000, /**<\brief The agent is not running;
|
||||
* iJIT_NotifyEvent calls will
|
||||
* not be processed. */
|
||||
iJIT_SAMPLING_ON = 0x0001, /**<\brief The agent is running and
|
||||
* ready to process notifications. */
|
||||
} iJIT_IsProfilingActiveFlags;
|
||||
|
||||
/**
|
||||
* @brief Description of a single entry in the line number information of a code region.
|
||||
* @details A table of line number entries gives information about how the reported code region
|
||||
* is mapped to source file.
|
||||
* Intel(R) VTune(TM) Amplifier uses line number information to attribute
|
||||
* the samples (virtual address) to a line number. \n
|
||||
* It is acceptable to report different code addresses for the same source line:
|
||||
* @code
|
||||
* Offset LineNumber
|
||||
* 1 2
|
||||
* 12 4
|
||||
* 15 2
|
||||
* 18 1
|
||||
* 21 30
|
||||
*
|
||||
* VTune Amplifier constructs the following table using the client data
|
||||
*
|
||||
* Code subrange Line number
|
||||
* 0-1 2
|
||||
* 1-12 4
|
||||
* 12-15 2
|
||||
* 15-18 1
|
||||
* 18-21 30
|
||||
* @endcode
|
||||
*/
|
||||
typedef struct _LineNumberInfo
|
||||
{
|
||||
unsigned int Offset; /**<\brief Offset from the begining of the code region. */
|
||||
unsigned int LineNumber; /**<\brief Matching source line number offset (from beginning of source file). */
|
||||
|
||||
} *pLineNumberInfo, LineNumberInfo;
|
||||
|
||||
/**
|
||||
* @brief Enumerator for the code architecture.
|
||||
*/
|
||||
typedef enum _iJIT_CodeArchitecture
|
||||
{
|
||||
iJIT_CA_NATIVE = 0, /**<\brief Native to the process architecture that is calling it. */
|
||||
|
||||
iJIT_CA_32, /**<\brief 32-bit machine code. */
|
||||
|
||||
iJIT_CA_64 /**<\brief 64-bit machine code. */
|
||||
|
||||
} iJIT_CodeArchitecture;
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
/**
|
||||
* @brief Description of a JIT-compiled method
|
||||
* @details When you use the iJIT_Method_Load structure to describe
|
||||
* the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED
|
||||
* as an event type to report it.
|
||||
*/
|
||||
typedef struct _iJIT_Method_Load
|
||||
{
|
||||
unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
|
||||
* You must either use the API function
|
||||
* iJIT_GetNewMethodID to get a valid and unique
|
||||
* method ID, or else manage ID uniqueness
|
||||
* and correct range by yourself.\n
|
||||
* You must use the same method ID for all code
|
||||
* regions of the same method, otherwise different
|
||||
* method IDs specify different methods. */
|
||||
|
||||
char* method_name; /**<\brief The name of the method. It can be optionally
|
||||
* prefixed with its class name and appended with
|
||||
* its complete signature. Can't be NULL. */
|
||||
|
||||
void* method_load_address; /**<\brief The start virtual address of the method code
|
||||
* region. If NULL, data provided with
|
||||
* event are not accepted. */
|
||||
|
||||
unsigned int method_size; /**<\brief The code size of the method in memory.
|
||||
* If 0, then data provided with the event are not
|
||||
* accepted. */
|
||||
|
||||
unsigned int line_number_size; /**<\brief The number of entries in the line number
|
||||
* table.0 if none. */
|
||||
|
||||
pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
|
||||
* array. Can be NULL if
|
||||
* line_number_size is 0. See
|
||||
* LineNumberInfo Structure for a
|
||||
* description of a single entry in
|
||||
* the line number info array */
|
||||
|
||||
unsigned int class_id; /**<\brief This field is obsolete. */
|
||||
|
||||
char* class_file_name; /**<\brief Class name. Can be NULL.*/
|
||||
|
||||
char* source_file_name; /**<\brief Source file name. Can be NULL.*/
|
||||
|
||||
} *piJIT_Method_Load, iJIT_Method_Load;
|
||||
|
||||
/**
|
||||
* @brief Description of a JIT-compiled method
|
||||
* @details When you use the iJIT_Method_Load_V2 structure to describe
|
||||
* the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2
|
||||
* as an event type to report it.
|
||||
*/
|
||||
typedef struct _iJIT_Method_Load_V2
|
||||
{
|
||||
unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
|
||||
* You must either use the API function
|
||||
* iJIT_GetNewMethodID to get a valid and unique
|
||||
* method ID, or else manage ID uniqueness
|
||||
* and correct range by yourself.\n
|
||||
* You must use the same method ID for all code
|
||||
* regions of the same method, otherwise different
|
||||
* method IDs specify different methods. */
|
||||
|
||||
char* method_name; /**<\brief The name of the method. It can be optionally
|
||||
* prefixed with its class name and appended with
|
||||
* its complete signature. Can't be NULL. */
|
||||
|
||||
void* method_load_address; /**<\brief The start virtual address of the method code
|
||||
* region. If NULL, then data provided with the
|
||||
* event are not accepted. */
|
||||
|
||||
unsigned int method_size; /**<\brief The code size of the method in memory.
|
||||
* If 0, then data provided with the event are not
|
||||
* accepted. */
|
||||
|
||||
unsigned int line_number_size; /**<\brief The number of entries in the line number
|
||||
* table. 0 if none. */
|
||||
|
||||
pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
|
||||
* array. Can be NULL if
|
||||
* line_number_size is 0. See
|
||||
* LineNumberInfo Structure for a
|
||||
* description of a single entry in
|
||||
* the line number info array. */
|
||||
|
||||
char* class_file_name; /**<\brief Class name. Can be NULL. */
|
||||
|
||||
char* source_file_name; /**<\brief Source file name. Can be NULL. */
|
||||
|
||||
char* module_name; /**<\brief Module name. Can be NULL.
|
||||
The module name can be useful for distinguishing among
|
||||
different JIT engines. VTune Amplifier will display
|
||||
reported methods grouped by specific module. */
|
||||
|
||||
} *piJIT_Method_Load_V2, iJIT_Method_Load_V2;
|
||||
|
||||
/**
|
||||
* @brief Description of a JIT-compiled method
|
||||
* @details The iJIT_Method_Load_V3 structure is the same as iJIT_Method_Load_V2
|
||||
* with a newly introduced 'arch' field that specifies architecture of the code region.
|
||||
* When you use the iJIT_Method_Load_V3 structure to describe
|
||||
* the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3
|
||||
* as an event type to report it.
|
||||
*/
|
||||
typedef struct _iJIT_Method_Load_V3
|
||||
{
|
||||
unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
|
||||
* You must either use the API function
|
||||
* iJIT_GetNewMethodID to get a valid and unique
|
||||
* method ID, or manage ID uniqueness
|
||||
* and correct range by yourself.\n
|
||||
* You must use the same method ID for all code
|
||||
* regions of the same method, otherwise they are
|
||||
* treated as regions of different methods. */
|
||||
|
||||
char* method_name; /**<\brief The name of the method. It can be optionally
|
||||
* prefixed with its class name and appended with
|
||||
* its complete signature. Cannot be NULL. */
|
||||
|
||||
void* method_load_address; /**<\brief The start virtual address of the method code
|
||||
* region. If NULL, then data provided with the
|
||||
* event are not accepted. */
|
||||
|
||||
unsigned int method_size; /**<\brief The code size of the method in memory.
|
||||
* If 0, then data provided with the event are not
|
||||
* accepted. */
|
||||
|
||||
unsigned int line_number_size; /**<\brief The number of entries in the line number
|
||||
* table. 0 if none. */
|
||||
|
||||
pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
|
||||
* array. Can be NULL if
|
||||
* line_number_size is 0. See
|
||||
* LineNumberInfo Structure for a
|
||||
* description of a single entry in
|
||||
* the line number info array. */
|
||||
|
||||
char* class_file_name; /**<\brief Class name. Can be NULL. */
|
||||
|
||||
char* source_file_name; /**<\brief Source file name. Can be NULL. */
|
||||
|
||||
char* module_name; /**<\brief Module name. Can be NULL.
|
||||
* The module name can be useful for distinguishing among
|
||||
* different JIT engines. VTune Amplifier will display
|
||||
* reported methods grouped by specific module. */
|
||||
|
||||
iJIT_CodeArchitecture module_arch; /**<\brief Architecture of the method's code region.
|
||||
* By default, it is the same as the process
|
||||
* architecture that is calling it.
|
||||
* For example, you can use it if your 32-bit JIT
|
||||
* engine generates 64-bit code.
|
||||
*
|
||||
* If JIT engine reports both 32-bit and 64-bit types
|
||||
* of methods then VTune Amplifier splits the methods
|
||||
* with the same module name but with different
|
||||
* architectures in two different modules. VTune Amplifier
|
||||
* modifies the original name provided with a 64-bit method
|
||||
* version by ending it with '(64)' */
|
||||
|
||||
} *piJIT_Method_Load_V3, iJIT_Method_Load_V3;
|
||||
|
||||
/**
|
||||
* @brief Description of an inline JIT-compiled method
|
||||
* @details When you use the_iJIT_Method_Inline_Load structure to describe
|
||||
* the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED
|
||||
* as an event type to report it.
|
||||
*/
|
||||
typedef struct _iJIT_Method_Inline_Load
|
||||
{
|
||||
unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
|
||||
* You must either use the API function
|
||||
* iJIT_GetNewMethodID to get a valid and unique
|
||||
* method ID, or else manage ID uniqueness
|
||||
* and correct range by yourself. */
|
||||
|
||||
unsigned int parent_method_id; /**<\brief Unique immediate parent's method ID.
|
||||
* Cannot be 0.
|
||||
* You must either use the API function
|
||||
* iJIT_GetNewMethodID to get a valid and unique
|
||||
* method ID, or else manage ID uniqueness
|
||||
* and correct range by yourself. */
|
||||
|
||||
char* method_name; /**<\brief The name of the method. It can be optionally
|
||||
* prefixed with its class name and appended with
|
||||
* its complete signature. Can't be NULL. */
|
||||
|
||||
void* method_load_address; /** <\brief The virtual address on which the method
|
||||
* is inlined. If NULL, then data provided with
|
||||
* the event are not accepted. */
|
||||
|
||||
unsigned int method_size; /**<\brief The code size of the method in memory.
|
||||
* If 0, then data provided with the event are not
|
||||
* accepted. */
|
||||
|
||||
unsigned int line_number_size; /**<\brief The number of entries in the line number
|
||||
* table. 0 if none. */
|
||||
|
||||
pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
|
||||
* array. Can be NULL if
|
||||
* line_number_size is 0. See
|
||||
* LineNumberInfo Structure for a
|
||||
* description of a single entry in
|
||||
* the line number info array */
|
||||
|
||||
char* class_file_name; /**<\brief Class name. Can be NULL.*/
|
||||
|
||||
char* source_file_name; /**<\brief Source file name. Can be NULL.*/
|
||||
|
||||
} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load;
|
||||
|
||||
/** @cond exclude_from_documentation */
|
||||
/**
|
||||
* @brief Description of a segment type
|
||||
* @details Use the segment type to specify a type of data supplied
|
||||
* with the iJVM_EVENT_TYPE_METHOD_UPDATE_V2 event to be applied to
|
||||
* a certain code trace.
|
||||
*/
|
||||
typedef enum _iJIT_SegmentType
|
||||
{
|
||||
iJIT_CT_UNKNOWN = 0,
|
||||
|
||||
iJIT_CT_CODE, /**<\brief Executable code. */
|
||||
|
||||
iJIT_CT_DATA, /**<\brief Data (not executable code).
|
||||
* VTune Amplifier uses the format string
|
||||
* (see iJIT_Method_Update) to represent
|
||||
* this data in the VTune Amplifier GUI */
|
||||
|
||||
iJIT_CT_KEEP, /**<\brief Use the previous markup for the trace.
|
||||
* Can be used for the following
|
||||
* iJVM_EVENT_TYPE_METHOD_UPDATE_V2 events,
|
||||
* if the type of the previously reported segment
|
||||
* type is the same. */
|
||||
iJIT_CT_EOF
|
||||
} iJIT_SegmentType;
|
||||
|
||||
/**
|
||||
* @brief Description of a dynamic update of the content within JIT-compiled method
|
||||
* @details The JIT engine may generate the methods that are updated at runtime
|
||||
* partially by mixed (data + executable code) content. When you use the iJIT_Method_Update
|
||||
* structure to describe the update of the content within a JIT-compiled method,
|
||||
* use iJVM_EVENT_TYPE_METHOD_UPDATE_V2 as an event type to report it.
|
||||
*
|
||||
* On the first Update event, VTune Amplifier copies the original code range reported by
|
||||
* the iJVM_EVENT_TYPE_METHOD_LOAD event, then modifies it with the supplied bytes and
|
||||
* adds the modified range to the original method. For next update events, VTune Amplifier
|
||||
* does the same but it uses the latest modified version of a code region for update.
|
||||
* Eventually, VTune Amplifier GUI displays multiple code ranges for the method reported by
|
||||
* the iJVM_EVENT_TYPE_METHOD_LOAD event.
|
||||
* Notes:
|
||||
* - Multiple update events with different types for the same trace are allowed
|
||||
* but they must be reported for the same code ranges.
|
||||
* Example,
|
||||
* @code
|
||||
* [-- data---] Allowed
|
||||
* [-- code --] Allowed
|
||||
* [code] Ignored
|
||||
* [-- data---] Allowed
|
||||
* [-- code --] Allowed
|
||||
* [------------ trace ---------]
|
||||
* @endcode
|
||||
* - The types of previously reported events can be changed but they must be reported
|
||||
* for the same code ranges.
|
||||
* Example,
|
||||
* @code
|
||||
* [-- data---] Allowed
|
||||
* [-- code --] Allowed
|
||||
* [-- data---] Allowed
|
||||
* [-- code --] Allowed
|
||||
* [------------ trace ---------]
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
typedef struct _iJIT_Method_Update
|
||||
{
|
||||
void* load_address; /**<\brief Start address of the update within a method */
|
||||
|
||||
unsigned int size; /**<\brief The update size */
|
||||
|
||||
iJIT_SegmentType type; /**<\brief Type of the update */
|
||||
|
||||
const char* data_format; /**<\brief C string that contains a format string
|
||||
* that follows the same specifications as format in printf.
|
||||
* The format string is used for iJIT_CT_CODE only
|
||||
* and cannot be NULL.
|
||||
* Format can be changed on the fly. */
|
||||
} *piJIT_Method_Update, iJIT_Method_Update;
|
||||
|
||||
/** @endcond */
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/** @cond exclude_from_documentation */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef JITAPI_CDECL
|
||||
# if defined WIN32 || defined _WIN32
|
||||
# define JITAPI_CDECL __cdecl
|
||||
# else /* defined WIN32 || defined _WIN32 */
|
||||
# if defined _M_IX86 || defined __i386__
|
||||
# define JITAPI_CDECL __attribute__ ((cdecl))
|
||||
# else /* _M_IX86 || __i386__ */
|
||||
# define JITAPI_CDECL /* actual only on x86_64 platform */
|
||||
# endif /* _M_IX86 || __i386__ */
|
||||
# endif /* defined WIN32 || defined _WIN32 */
|
||||
#endif /* JITAPI_CDECL */
|
||||
|
||||
#define JITAPI JITAPI_CDECL
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief Generates a new unique method ID.
|
||||
*
|
||||
* You must use this API to obtain unique and valid method IDs for methods or
|
||||
* traces reported to the agent if you don't have your own mechanism to generate
|
||||
* unique method IDs.
|
||||
*
|
||||
* @return a new unique method ID. When out of unique method IDs, this API
|
||||
* returns 0, which is not an accepted value.
|
||||
*/
|
||||
unsigned int JITAPI iJIT_GetNewMethodID(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the current mode of the agent.
|
||||
*
|
||||
* @return iJIT_SAMPLING_ON, indicating that agent is running, or
|
||||
* iJIT_NOTHING_RUNNING if no agent is running.
|
||||
*/
|
||||
iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
|
||||
|
||||
/**
|
||||
* @brief Reports infomation about JIT-compiled code to the agent.
|
||||
*
|
||||
* The reported information is used to attribute samples obtained from any
|
||||
* Intel(R) VTune(TM) Amplifier collector. This API needs to be called
|
||||
* after JIT compilation and before the first entry into the JIT-compiled
|
||||
* code.
|
||||
*
|
||||
* @param[in] event_type - type of the data sent to the agent
|
||||
* @param[in] EventSpecificData - pointer to event-specific data
|
||||
*
|
||||
* @returns 1 on success, otherwise 0.
|
||||
*/
|
||||
int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
/** @endcond */
|
||||
|
||||
/** @} jitapi group */
|
||||
|
||||
#endif /* __JITPROFILING_H__ */
|
1039
3rdparty/ittnotify/include/legacy/ittnotify.h
vendored
Normal file
1039
3rdparty/ittnotify/include/legacy/ittnotify.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
71
3rdparty/ittnotify/include/libittnotify.h
vendored
Normal file
71
3rdparty/ittnotify/include/libittnotify.h
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#ifndef _LIBITTNOTIFY_H_
|
||||
#define _LIBITTNOTIFY_H_
|
||||
|
||||
#ifndef __ITT_INTERNAL_INCLUDE
|
||||
# if defined WIN32 || defined _WIN32
|
||||
# pragma message("WARNING!!! Include file libittnotify.h is deprecated and should not be included anymore")
|
||||
# else /* WIN32 */
|
||||
# warning "Include file libittnotify.h is deprecated and should not be included anymore"
|
||||
# endif /* WIN32 */
|
||||
#endif /* __ITT_INTERNAL_INCLUDE */
|
||||
#include "legacy/ittnotify.h"
|
||||
|
||||
#endif /* _LIBITTNOTIFY_H_ */
|
241
3rdparty/ittnotify/include/llvm_jit_event_listener.hpp
vendored
Normal file
241
3rdparty/ittnotify/include/llvm_jit_event_listener.hpp
vendored
Normal file
@ -0,0 +1,241 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
/*
|
||||
* This file implements an interface bridge from Low-Level Virtual Machine
|
||||
* llvm::JITEventListener to Intel JIT Profiling API. It passes the function
|
||||
* and line information to the appropriate functions in the JIT profiling
|
||||
* interface so that any LLVM-based JIT engine can emit the JIT code
|
||||
* notifications that the profiler will receive.
|
||||
*
|
||||
* Usage model:
|
||||
*
|
||||
* 1. Register the listener implementation instance with the execution engine:
|
||||
*
|
||||
* #include <llvm_jit_event_listener.hpp>
|
||||
* ...
|
||||
* ExecutionEngine *TheExecutionEngine;
|
||||
* ...
|
||||
* TheExecutionEngine = EngineBuilder(TheModule).create();
|
||||
* ...
|
||||
* __itt_llvm_jit_event_listener jitListener;
|
||||
* TheExecutionEngine->RegisterJITEventListener(&jitListener);
|
||||
* ...
|
||||
*
|
||||
* 2. When compiling make sure to add the ITT API include directory to the
|
||||
* compiler include directories, ITT API library directory to the linker
|
||||
* library directories and link with jitprofling static library.
|
||||
*/
|
||||
|
||||
#ifndef __ITT_LLVM_JIT_EVENT_LISTENER_HPP__
|
||||
#define __ITT_LLVM_JIT_EVENT_LISTENER_HPP__
|
||||
|
||||
#include "jitprofiling.h"
|
||||
|
||||
#include <llvm/Function.h>
|
||||
#include <llvm/ExecutionEngine/JITEventListener.h>
|
||||
#include <llvm/ADT/StringRef.h>
|
||||
#include <llvm/Analysis/DebugInfo.h>
|
||||
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
// Uncomment the line below to turn on logging to stderr
|
||||
#define JITPROFILING_DEBUG_ENABLE
|
||||
|
||||
// Some elementary logging support
|
||||
#ifdef JITPROFILING_DEBUG_ENABLE
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
static void _jit_debug(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
// Use the macro as JITDEBUG(("foo: %d", foo_val));
|
||||
#define JITDEBUG(x) \
|
||||
do { \
|
||||
_jit_debug("jit-listener: "); \
|
||||
_jit_debug x; \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
#define JITDEBUG(x)
|
||||
#endif
|
||||
|
||||
// LLVM JIT event listener, translates the notifications to the JIT profiling
|
||||
// API information.
|
||||
class __itt_llvm_jit_event_listener : public llvm::JITEventListener
|
||||
{
|
||||
public:
|
||||
__itt_llvm_jit_event_listener() {}
|
||||
|
||||
public:
|
||||
virtual void NotifyFunctionEmitted(const llvm::Function &F,
|
||||
void *Code, size_t Size, const EmittedFunctionDetails &Details)
|
||||
{
|
||||
std::string name = F.getName().str();
|
||||
JITDEBUG(("function jitted:\n"));
|
||||
JITDEBUG((" addr=0x%08x\n", (int)Code));
|
||||
JITDEBUG((" name=`%s'\n", name.c_str()));
|
||||
JITDEBUG((" code-size=%d\n", (int)Size));
|
||||
JITDEBUG((" line-infos-count=%d\n", Details.LineStarts.size()));
|
||||
|
||||
// The method must not be in the map - the entry must have been cleared
|
||||
// from the map in NotifyFreeingMachineCode in case of rejitting.
|
||||
assert(m_addr2MethodId.find(Code) == m_addr2MethodId.end());
|
||||
|
||||
int mid = iJIT_GetNewMethodID();
|
||||
m_addr2MethodId[Code] = mid;
|
||||
|
||||
iJIT_Method_Load mload;
|
||||
memset(&mload, 0, sizeof mload);
|
||||
mload.method_id = mid;
|
||||
|
||||
// Populate the method size and name information
|
||||
// TODO: The JIT profiling API should have members as const char pointers.
|
||||
mload.method_name = (char*)name.c_str();
|
||||
mload.method_load_address = Code;
|
||||
mload.method_size = (unsigned int)Size;
|
||||
|
||||
// Populate line information now.
|
||||
// From the JIT API documentation it is not quite clear whether the
|
||||
// line information can be given in ranges, so we'll populate it for
|
||||
// every byte of the function, hmm.
|
||||
std::string srcFilePath;
|
||||
std::vector<LineNumberInfo> lineInfos;
|
||||
char *addr = (char*)Code;
|
||||
char *lineAddr = addr; // Exclusive end point at which current
|
||||
// line info changes.
|
||||
const llvm::DebugLoc* loc = 0; // Current line info
|
||||
int lineIndex = -1; // Current index into the line info table
|
||||
for (int i = 0; i < Size; ++i, ++addr) {
|
||||
while (addr >= lineAddr) {
|
||||
if (lineIndex >= 0 && lineIndex < Details.LineStarts.size()) {
|
||||
loc = &Details.LineStarts[lineIndex].Loc;
|
||||
std::string p = getSrcFilePath(F.getContext(), *loc);
|
||||
assert(srcFilePath.empty() || p == srcFilePath);
|
||||
srcFilePath = p;
|
||||
} else {
|
||||
loc = NULL;
|
||||
}
|
||||
lineIndex++;
|
||||
if (lineIndex >= 0 && lineIndex < Details.LineStarts.size()) {
|
||||
lineAddr = (char*)Details.LineStarts[lineIndex].Address;
|
||||
} else {
|
||||
lineAddr = addr + Size;
|
||||
}
|
||||
}
|
||||
if (loc) {
|
||||
int line = loc->getLine();
|
||||
LineNumberInfo info = { i, line };
|
||||
lineInfos.push_back(info);
|
||||
JITDEBUG((" addr 0x%08x -> line %d\n", addr, line));
|
||||
}
|
||||
}
|
||||
if (!lineInfos.empty()) {
|
||||
mload.line_number_size = lineInfos.size();
|
||||
JITDEBUG((" translated to %d line infos to JIT", (int)lineInfos.size()));
|
||||
mload.line_number_table = &lineInfos[0];
|
||||
mload.source_file_name = (char*)srcFilePath.c_str();
|
||||
}
|
||||
|
||||
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &mload);
|
||||
}
|
||||
|
||||
virtual void NotifyFreeingMachineCode(void *OldPtr)
|
||||
{
|
||||
JITDEBUG(("function unjitted\n"));
|
||||
JITDEBUG((" addr=0x%08x\n", (int)OldPtr));
|
||||
Addr2MethodId::iterator it = m_addr2MethodId.find(OldPtr);
|
||||
assert(it != m_addr2MethodId.end());
|
||||
iJIT_Method_Id mid = { it->second };
|
||||
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_UNLOAD_START, &mid);
|
||||
m_addr2MethodId.erase(it);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string getSrcFilePath(const llvm::LLVMContext& ctx, const llvm::DebugLoc& loc)
|
||||
{
|
||||
llvm::MDNode* node = loc.getAsMDNode(ctx);
|
||||
llvm::DILocation srcLoc(node);
|
||||
return srcLoc.getDirectory().str() + "/" + srcLoc.getFilename().str();
|
||||
}
|
||||
|
||||
private:
|
||||
/// Don't copy
|
||||
__itt_llvm_jit_event_listener(const __itt_llvm_jit_event_listener&);
|
||||
__itt_llvm_jit_event_listener& operator=(const __itt_llvm_jit_event_listener&);
|
||||
|
||||
private:
|
||||
typedef std::vector<LineNumberInfo> LineInfoList;
|
||||
|
||||
// The method unload notification in VTune JIT profiling API takes the
|
||||
// method ID, not method address so have to maintain the mapping. Is
|
||||
// there a more efficient and simple way to do this like attaching the
|
||||
// method ID information somehow to the LLVM function instance?
|
||||
//
|
||||
// TODO: It would be more convenient for the JIT API to take the method
|
||||
// address, not method ID.
|
||||
typedef std::map<const void*, int> Addr2MethodId;
|
||||
Addr2MethodId m_addr2MethodId;
|
||||
};
|
||||
|
||||
#endif // Header guard
|
7
3rdparty/ittnotify/src/ittnotify/LICENSE.BSD
vendored
Normal file
7
3rdparty/ittnotify/src/ittnotify/LICENSE.BSD
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2011, Intel Corporation
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
• Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
65
3rdparty/ittnotify/src/ittnotify/LICENSE.GPL
vendored
Normal file
65
3rdparty/ittnotify/src/ittnotify/LICENSE.GPL
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
The GNU General Public License (GPL)
|
||||
Version 2, June 1991
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
NO WARRANTY
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
How to Apply These Terms to Your New Programs
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
One line to give the program's name and a brief idea of what it does.
|
||||
Copyright (C) <year> <name of author>
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
signature of Ty Coon, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
|
77
3rdparty/ittnotify/src/ittnotify/disable_warnings.h
vendored
Normal file
77
3rdparty/ittnotify/src/ittnotify/disable_warnings.h
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#include "ittnotify_config.h"
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
|
||||
#pragma warning (disable: 593) /* parameter "XXXX" was set but never used */
|
||||
#pragma warning (disable: 344) /* typedef name has already been declared (with same type) */
|
||||
#pragma warning (disable: 174) /* expression has no effect */
|
||||
#pragma warning (disable: 4127) /* conditional expression is constant */
|
||||
#pragma warning (disable: 4306) /* conversion from '?' to '?' of greater size */
|
||||
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if defined __INTEL_COMPILER
|
||||
|
||||
#pragma warning (disable: 869) /* parameter "XXXXX" was never referenced */
|
||||
#pragma warning (disable: 1418) /* external function definition with no prior declaration */
|
||||
#pragma warning (disable: 1419) /* external declaration in primary source file */
|
||||
|
||||
#endif /* __INTEL_COMPILER */
|
616
3rdparty/ittnotify/src/ittnotify/ittnotify_config.h
vendored
Normal file
616
3rdparty/ittnotify/src/ittnotify/ittnotify_config.h
vendored
Normal file
@ -0,0 +1,616 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
#ifndef _ITTNOTIFY_CONFIG_H_
|
||||
#define _ITTNOTIFY_CONFIG_H_
|
||||
|
||||
/** @cond exclude_from_documentation */
|
||||
#ifndef ITT_OS_WIN
|
||||
# define ITT_OS_WIN 1
|
||||
#endif /* ITT_OS_WIN */
|
||||
|
||||
#ifndef ITT_OS_LINUX
|
||||
# define ITT_OS_LINUX 2
|
||||
#endif /* ITT_OS_LINUX */
|
||||
|
||||
#ifndef ITT_OS_MAC
|
||||
# define ITT_OS_MAC 3
|
||||
#endif /* ITT_OS_MAC */
|
||||
|
||||
#ifndef ITT_OS_FREEBSD
|
||||
# define ITT_OS_FREEBSD 4
|
||||
#endif /* ITT_OS_FREEBSD */
|
||||
|
||||
#ifndef ITT_OS
|
||||
# if defined WIN32 || defined _WIN32
|
||||
# define ITT_OS ITT_OS_WIN
|
||||
# elif defined( __APPLE__ ) && defined( __MACH__ )
|
||||
# define ITT_OS ITT_OS_MAC
|
||||
# elif defined( __FreeBSD__ )
|
||||
# define ITT_OS ITT_OS_FREEBSD
|
||||
# else
|
||||
# define ITT_OS ITT_OS_LINUX
|
||||
# endif
|
||||
#endif /* ITT_OS */
|
||||
|
||||
#ifndef ITT_PLATFORM_WIN
|
||||
# define ITT_PLATFORM_WIN 1
|
||||
#endif /* ITT_PLATFORM_WIN */
|
||||
|
||||
#ifndef ITT_PLATFORM_POSIX
|
||||
# define ITT_PLATFORM_POSIX 2
|
||||
#endif /* ITT_PLATFORM_POSIX */
|
||||
|
||||
#ifndef ITT_PLATFORM_MAC
|
||||
# define ITT_PLATFORM_MAC 3
|
||||
#endif /* ITT_PLATFORM_MAC */
|
||||
|
||||
#ifndef ITT_PLATFORM_FREEBSD
|
||||
# define ITT_PLATFORM_FREEBSD 4
|
||||
#endif /* ITT_PLATFORM_FREEBSD */
|
||||
|
||||
#ifndef ITT_PLATFORM
|
||||
# if ITT_OS==ITT_OS_WIN
|
||||
# define ITT_PLATFORM ITT_PLATFORM_WIN
|
||||
# elif ITT_OS==ITT_OS_MAC
|
||||
# define ITT_PLATFORM ITT_PLATFORM_MAC
|
||||
# elif ITT_OS==ITT_OS_FREEBSD
|
||||
# define ITT_PLATFORM ITT_PLATFORM_FREEBSD
|
||||
# else
|
||||
# define ITT_PLATFORM ITT_PLATFORM_POSIX
|
||||
# endif
|
||||
#endif /* ITT_PLATFORM */
|
||||
|
||||
#if defined(_UNICODE) && !defined(UNICODE)
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
#include <tchar.h>
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#include <stdint.h>
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
#include <wchar.h>
|
||||
#endif /* UNICODE || _UNICODE */
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#ifndef ITTAPI_CDECL
|
||||
# if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
# define ITTAPI_CDECL __cdecl
|
||||
# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
# if defined _M_IX86 || defined __i386__
|
||||
# define ITTAPI_CDECL __attribute__ ((cdecl))
|
||||
# else /* _M_IX86 || __i386__ */
|
||||
# define ITTAPI_CDECL /* actual only on x86 platform */
|
||||
# endif /* _M_IX86 || __i386__ */
|
||||
# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* ITTAPI_CDECL */
|
||||
|
||||
#ifndef STDCALL
|
||||
# if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
# define STDCALL __stdcall
|
||||
# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
# if defined _M_IX86 || defined __i386__
|
||||
# define STDCALL __attribute__ ((stdcall))
|
||||
# else /* _M_IX86 || __i386__ */
|
||||
# define STDCALL /* supported only on x86 platform */
|
||||
# endif /* _M_IX86 || __i386__ */
|
||||
# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* STDCALL */
|
||||
|
||||
#define ITTAPI ITTAPI_CDECL
|
||||
#define LIBITTAPI ITTAPI_CDECL
|
||||
|
||||
/* TODO: Temporary for compatibility! */
|
||||
#define ITTAPI_CALL ITTAPI_CDECL
|
||||
#define LIBITTAPI_CALL ITTAPI_CDECL
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
/* use __forceinline (VC++ specific) */
|
||||
#define ITT_INLINE __forceinline
|
||||
#define ITT_INLINE_ATTRIBUTE /* nothing */
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
/*
|
||||
* Generally, functions are not inlined unless optimization is specified.
|
||||
* For functions declared inline, this attribute inlines the function even
|
||||
* if no optimization level was specified.
|
||||
*/
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define ITT_INLINE static
|
||||
#define ITT_INLINE_ATTRIBUTE __attribute__((unused))
|
||||
#else /* __STRICT_ANSI__ */
|
||||
#define ITT_INLINE static inline
|
||||
#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
/** @endcond */
|
||||
|
||||
#ifndef ITT_ARCH_IA32
|
||||
# define ITT_ARCH_IA32 1
|
||||
#endif /* ITT_ARCH_IA32 */
|
||||
|
||||
#ifndef ITT_ARCH_IA32E
|
||||
# define ITT_ARCH_IA32E 2
|
||||
#endif /* ITT_ARCH_IA32E */
|
||||
|
||||
#ifndef ITT_ARCH_ARM
|
||||
# define ITT_ARCH_ARM 4
|
||||
#endif /* ITT_ARCH_ARM */
|
||||
|
||||
#ifndef ITT_ARCH_PPC64
|
||||
# define ITT_ARCH_PPC64 5
|
||||
#endif /* ITT_ARCH_PPC64 */
|
||||
|
||||
#ifndef ITT_ARCH
|
||||
# if defined _M_IX86 || defined __i386__
|
||||
# define ITT_ARCH ITT_ARCH_IA32
|
||||
# elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
|
||||
# define ITT_ARCH ITT_ARCH_IA32E
|
||||
# elif defined _M_IA64 || defined __ia64__
|
||||
# define ITT_ARCH ITT_ARCH_IA64
|
||||
# elif defined _M_ARM || defined __arm__
|
||||
# define ITT_ARCH ITT_ARCH_ARM
|
||||
# elif defined __powerpc64__
|
||||
# define ITT_ARCH ITT_ARCH_PPC64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define ITT_EXTERN_C extern "C"
|
||||
# define ITT_EXTERN_C_BEGIN extern "C" {
|
||||
# define ITT_EXTERN_C_END }
|
||||
#else
|
||||
# define ITT_EXTERN_C /* nothing */
|
||||
# define ITT_EXTERN_C_BEGIN /* nothing */
|
||||
# define ITT_EXTERN_C_END /* nothing */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define ITT_TO_STR_AUX(x) #x
|
||||
#define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
|
||||
|
||||
#define __ITT_BUILD_ASSERT(expr, suffix) do { \
|
||||
static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
|
||||
__itt_build_check_##suffix[0] = 0; \
|
||||
} while(0)
|
||||
#define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
|
||||
#define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
|
||||
|
||||
#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
|
||||
|
||||
/* Replace with snapshot date YYYYMMDD for promotion build. */
|
||||
#define API_VERSION_BUILD 20151119
|
||||
|
||||
#ifndef API_VERSION_NUM
|
||||
#define API_VERSION_NUM 0.0.0
|
||||
#endif /* API_VERSION_NUM */
|
||||
|
||||
#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
|
||||
" (" ITT_TO_STR(API_VERSION_BUILD) ")"
|
||||
|
||||
/* OS communication functions */
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
#include <windows.h>
|
||||
typedef HMODULE lib_t;
|
||||
typedef DWORD TIDT;
|
||||
typedef CRITICAL_SECTION mutex_t;
|
||||
#define MUTEX_INITIALIZER { 0 }
|
||||
#define strong_alias(name, aliasname) /* empty for Windows */
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#include <dlfcn.h>
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
#include <wchar.h>
|
||||
#endif /* UNICODE */
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
|
||||
#endif /* _GNU_SOURCE */
|
||||
#ifndef __USE_UNIX98
|
||||
#define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */
|
||||
#endif /*__USE_UNIX98*/
|
||||
#include <pthread.h>
|
||||
typedef void* lib_t;
|
||||
typedef pthread_t TIDT;
|
||||
typedef pthread_mutex_t mutex_t;
|
||||
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define _strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
||||
#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
#define __itt_get_proc(lib, name) GetProcAddress(lib, name)
|
||||
#define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
|
||||
#define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
|
||||
#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
|
||||
#define __itt_load_lib(name) LoadLibraryA(name)
|
||||
#define __itt_unload_lib(handle) FreeLibrary(handle)
|
||||
#define __itt_system_error() (int)GetLastError()
|
||||
#define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
|
||||
#define __itt_fstrnlen(s, l) strnlen_s(s, l)
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
|
||||
#define __itt_fstrdup(s) _strdup(s)
|
||||
#define __itt_thread_id() GetCurrentThreadId()
|
||||
#define __itt_thread_yield() SwitchToThread()
|
||||
#ifndef ITT_SIMPLE_INIT
|
||||
ITT_INLINE long
|
||||
__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
|
||||
ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
|
||||
{
|
||||
return InterlockedIncrement(ptr);
|
||||
}
|
||||
#endif /* ITT_SIMPLE_INIT */
|
||||
|
||||
#define DL_SYMBOLS (1)
|
||||
#define PTHREAD_SYMBOLS (1)
|
||||
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
#define __itt_get_proc(lib, name) dlsym(lib, name)
|
||||
#define __itt_mutex_init(mutex) {\
|
||||
pthread_mutexattr_t mutex_attr; \
|
||||
int error_code = pthread_mutexattr_init(&mutex_attr); \
|
||||
if (error_code) \
|
||||
__itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
|
||||
error_code); \
|
||||
error_code = pthread_mutexattr_settype(&mutex_attr, \
|
||||
PTHREAD_MUTEX_RECURSIVE); \
|
||||
if (error_code) \
|
||||
__itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
|
||||
error_code); \
|
||||
error_code = pthread_mutex_init(mutex, &mutex_attr); \
|
||||
if (error_code) \
|
||||
__itt_report_error(__itt_error_system, "pthread_mutex_init", \
|
||||
error_code); \
|
||||
error_code = pthread_mutexattr_destroy(&mutex_attr); \
|
||||
if (error_code) \
|
||||
__itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
|
||||
error_code); \
|
||||
}
|
||||
#define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
|
||||
#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
|
||||
#define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
|
||||
#define __itt_unload_lib(handle) dlclose(handle)
|
||||
#define __itt_system_error() errno
|
||||
#define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
|
||||
|
||||
/* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
|
||||
#ifdef SDL_STRNLEN_S
|
||||
#define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
|
||||
#else
|
||||
#define __itt_fstrnlen(s, l) strlen(s)
|
||||
#endif /* SDL_STRNLEN_S */
|
||||
#ifdef SDL_STRNCPY_S
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
|
||||
#else
|
||||
#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l)
|
||||
#endif /* SDL_STRNCPY_S */
|
||||
|
||||
#define __itt_fstrdup(s) strdup(s)
|
||||
#define __itt_thread_id() pthread_self()
|
||||
#define __itt_thread_yield() sched_yield()
|
||||
#if ITT_ARCH==ITT_ARCH_IA64
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
|
||||
#else /* __INTEL_COMPILER */
|
||||
/* TODO: Add Support for not Intel compilers for IA-64 architecture */
|
||||
#endif /* __INTEL_COMPILER */
|
||||
#elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
|
||||
ITT_INLINE long
|
||||
__TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
|
||||
ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
|
||||
{
|
||||
long result;
|
||||
__asm__ __volatile__("lock\nxadd %0,%1"
|
||||
: "=r"(result),"=m"(*(int*)ptr)
|
||||
: "0"(addend), "m"(*(int*)ptr)
|
||||
: "memory");
|
||||
return result;
|
||||
}
|
||||
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
|
||||
#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
|
||||
#endif /* ITT_ARCH==ITT_ARCH_IA64 */
|
||||
#ifndef ITT_SIMPLE_INIT
|
||||
ITT_INLINE long
|
||||
__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
|
||||
ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
|
||||
{
|
||||
return __TBB_machine_fetchadd4(ptr, 1) + 1L;
|
||||
}
|
||||
#endif /* ITT_SIMPLE_INIT */
|
||||
|
||||
void* dlopen(const char*, int) __attribute__((weak));
|
||||
void* dlsym(void*, const char*) __attribute__((weak));
|
||||
int dlclose(void*) __attribute__((weak));
|
||||
#define DL_SYMBOLS (dlopen && dlsym && dlclose)
|
||||
|
||||
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __attribute__((weak));
|
||||
int pthread_mutex_lock(pthread_mutex_t*) __attribute__((weak));
|
||||
int pthread_mutex_unlock(pthread_mutex_t*) __attribute__((weak));
|
||||
int pthread_mutex_destroy(pthread_mutex_t*) __attribute__((weak));
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t*) __attribute__((weak));
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t*, int) __attribute__((weak));
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t*) __attribute__((weak));
|
||||
pthread_t pthread_self(void) __attribute__((weak));
|
||||
#define PTHREAD_SYMBOLS (pthread_mutex_init && pthread_mutex_lock && pthread_mutex_unlock && pthread_mutex_destroy && pthread_mutexattr_init && pthread_mutexattr_settype && pthread_mutexattr_destroy && pthread_self)
|
||||
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
typedef enum {
|
||||
__itt_collection_normal = 0,
|
||||
__itt_collection_paused = 1
|
||||
} __itt_collection_state;
|
||||
|
||||
typedef enum {
|
||||
__itt_thread_normal = 0,
|
||||
__itt_thread_ignored = 1
|
||||
} __itt_thread_state;
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
typedef struct ___itt_thread_info
|
||||
{
|
||||
const char* nameA; /*!< Copy of original name in ASCII. */
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
|
||||
#else /* UNICODE || _UNICODE */
|
||||
void* nameW;
|
||||
#endif /* UNICODE || _UNICODE */
|
||||
TIDT tid;
|
||||
__itt_thread_state state; /*!< Thread state (paused or normal) */
|
||||
int extra1; /*!< Reserved to the runtime */
|
||||
void* extra2; /*!< Reserved to the runtime */
|
||||
struct ___itt_thread_info* next;
|
||||
} __itt_thread_info;
|
||||
|
||||
#include "ittnotify_types.h" /* For __itt_group_id definition */
|
||||
|
||||
typedef struct ___itt_api_info_20101001
|
||||
{
|
||||
const char* name;
|
||||
void** func_ptr;
|
||||
void* init_func;
|
||||
__itt_group_id group;
|
||||
} __itt_api_info_20101001;
|
||||
|
||||
typedef struct ___itt_api_info
|
||||
{
|
||||
const char* name;
|
||||
void** func_ptr;
|
||||
void* init_func;
|
||||
void* null_func;
|
||||
__itt_group_id group;
|
||||
} __itt_api_info;
|
||||
|
||||
typedef struct __itt_counter_info
|
||||
{
|
||||
const char* nameA; /*!< Copy of original name in ASCII. */
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
|
||||
#else /* UNICODE || _UNICODE */
|
||||
void* nameW;
|
||||
#endif /* UNICODE || _UNICODE */
|
||||
const char* domainA; /*!< Copy of original name in ASCII. */
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
const wchar_t* domainW; /*!< Copy of original name in UNICODE. */
|
||||
#else /* UNICODE || _UNICODE */
|
||||
void* domainW;
|
||||
#endif /* UNICODE || _UNICODE */
|
||||
int type;
|
||||
long index;
|
||||
int extra1; /*!< Reserved to the runtime */
|
||||
void* extra2; /*!< Reserved to the runtime */
|
||||
struct __itt_counter_info* next;
|
||||
} __itt_counter_info_t;
|
||||
|
||||
struct ___itt_domain;
|
||||
struct ___itt_string_handle;
|
||||
|
||||
typedef struct ___itt_global
|
||||
{
|
||||
unsigned char magic[8];
|
||||
unsigned long version_major;
|
||||
unsigned long version_minor;
|
||||
unsigned long version_build;
|
||||
volatile long api_initialized;
|
||||
volatile long mutex_initialized;
|
||||
volatile long atomic_counter;
|
||||
mutex_t mutex;
|
||||
lib_t lib;
|
||||
void* error_handler;
|
||||
const char** dll_path_ptr;
|
||||
__itt_api_info* api_list_ptr;
|
||||
struct ___itt_global* next;
|
||||
/* Joinable structures below */
|
||||
__itt_thread_info* thread_list;
|
||||
struct ___itt_domain* domain_list;
|
||||
struct ___itt_string_handle* string_list;
|
||||
__itt_collection_state state;
|
||||
__itt_counter_info_t* counter_list;
|
||||
} __itt_global;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
|
||||
h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
|
||||
if (h != NULL) { \
|
||||
h->tid = t; \
|
||||
h->nameA = NULL; \
|
||||
h->nameW = n ? _wcsdup(n) : NULL; \
|
||||
h->state = s; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->thread_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
|
||||
h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
|
||||
if (h != NULL) { \
|
||||
h->tid = t; \
|
||||
h->nameA = n ? __itt_fstrdup(n) : NULL; \
|
||||
h->nameW = NULL; \
|
||||
h->state = s; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->thread_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
|
||||
h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
|
||||
if (h != NULL) { \
|
||||
h->flags = 1; /* domain is enabled by default */ \
|
||||
h->nameA = NULL; \
|
||||
h->nameW = name ? _wcsdup(name) : NULL; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->domain_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
|
||||
h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
|
||||
if (h != NULL) { \
|
||||
h->flags = 1; /* domain is enabled by default */ \
|
||||
h->nameA = name ? __itt_fstrdup(name) : NULL; \
|
||||
h->nameW = NULL; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->domain_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
|
||||
h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
|
||||
if (h != NULL) { \
|
||||
h->strA = NULL; \
|
||||
h->strW = name ? _wcsdup(name) : NULL; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->string_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
|
||||
h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
|
||||
if (h != NULL) { \
|
||||
h->strA = name ? __itt_fstrdup(name) : NULL; \
|
||||
h->strW = NULL; \
|
||||
h->extra1 = 0; /* reserved */ \
|
||||
h->extra2 = NULL; /* reserved */ \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->string_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \
|
||||
h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
|
||||
if (h != NULL) { \
|
||||
h->nameA = NULL; \
|
||||
h->nameW = name ? _wcsdup(name) : NULL; \
|
||||
h->domainA = NULL; \
|
||||
h->domainW = name ? _wcsdup(domain) : NULL; \
|
||||
h->type = type; \
|
||||
h->index = 0; \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->counter_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \
|
||||
h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
|
||||
if (h != NULL) { \
|
||||
h->nameA = name ? __itt_fstrdup(name) : NULL; \
|
||||
h->nameW = NULL; \
|
||||
h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
|
||||
h->domainW = NULL; \
|
||||
h->type = type; \
|
||||
h->index = 0; \
|
||||
h->next = NULL; \
|
||||
if (h_tail == NULL) \
|
||||
(gptr)->counter_list = h; \
|
||||
else \
|
||||
h_tail->next = h; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* _ITTNOTIFY_CONFIG_H_ */
|
1236
3rdparty/ittnotify/src/ittnotify/ittnotify_static.c
vendored
Normal file
1236
3rdparty/ittnotify/src/ittnotify/ittnotify_static.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
389
3rdparty/ittnotify/src/ittnotify/ittnotify_static.h
vendored
Normal file
389
3rdparty/ittnotify/src/ittnotify/ittnotify_static.h
vendored
Normal file
@ -0,0 +1,389 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#include "ittnotify_config.h"
|
||||
|
||||
#ifndef ITT_FORMAT_DEFINED
|
||||
# ifndef ITT_FORMAT
|
||||
# define ITT_FORMAT
|
||||
# endif /* ITT_FORMAT */
|
||||
# ifndef ITT_NO_PARAMS
|
||||
# define ITT_NO_PARAMS
|
||||
# endif /* ITT_NO_PARAMS */
|
||||
#endif /* ITT_FORMAT_DEFINED */
|
||||
|
||||
/*
|
||||
* parameters for macro expected:
|
||||
* ITT_STUB(api, type, func_name, arguments, params, func_name_in_dll, group, printf_fmt)
|
||||
*/
|
||||
#ifdef __ITT_INTERNAL_INIT
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_domain*, domain_createA, (const char *name), (ITT_FORMAT name), domain_createA, __itt_group_structure, "\"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_domain*, domain_createW, (const wchar_t *name), (ITT_FORMAT name), domain_createW, __itt_group_structure, "\"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_domain*, domain_create, (const char *name), (ITT_FORMAT name), domain_create, __itt_group_structure, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createA, (const char *name), (ITT_FORMAT name), string_handle_createA, __itt_group_structure, "\"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createW, (const wchar_t *name), (ITT_FORMAT name), string_handle_createW, __itt_group_structure, "\"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_create, (const char *name), (ITT_FORMAT name), string_handle_create, __itt_group_structure, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_createA, (const char *name, const char *domain), (ITT_FORMAT name, domain), counter_createA, __itt_group_counter, "\"%s\", \"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_createW, (const wchar_t *name, const wchar_t *domain), (ITT_FORMAT name, domain), counter_createW, __itt_group_counter, "\"%s\", \"%s\"")
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_create, (const char *name, const char *domain), (ITT_FORMAT name, domain), counter_create, __itt_group_counter, "\"%s\", \"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_create_typedA, (const char *name, const char *domain, __itt_metadata_type type), (ITT_FORMAT name, domain, type), counter_create_typedA, __itt_group_counter, "\"%s\", \"%s\", %d")
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_create_typedW, (const wchar_t *name, const wchar_t *domain, __itt_metadata_type type), (ITT_FORMAT name, domain, type), counter_create_typedW, __itt_group_counter, "\"%s\", \"%s\", %d")
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_counter, counter_create_typed, (const char *name, const char *domain, __itt_metadata_type type), (ITT_FORMAT name, domain, type), counter_create_typed, __itt_group_counter, "\"%s\", \"%s\", %d")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
|
||||
ITT_STUBV(ITTAPI, void, pause, (void), (ITT_NO_PARAMS), pause, __itt_group_control | __itt_group_legacy, "no args")
|
||||
ITT_STUBV(ITTAPI, void, resume, (void), (ITT_NO_PARAMS), resume, __itt_group_control | __itt_group_legacy, "no args")
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, thread_set_nameA, (const char *name), (ITT_FORMAT name), thread_set_nameA, __itt_group_thread, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, thread_set_nameW, (const wchar_t *name), (ITT_FORMAT name), thread_set_nameW, __itt_group_thread, "\"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, thread_set_name, (const char *name), (ITT_FORMAT name), thread_set_name, __itt_group_thread, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, thread_ignore, (void), (ITT_NO_PARAMS), thread_ignore, __itt_group_thread, "no args")
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(LIBITTAPI, int, thr_name_setA, (const char *name, int namelen), (ITT_FORMAT name, namelen), thr_name_setA, __itt_group_thread | __itt_group_legacy, "\"%s\", %d")
|
||||
ITT_STUB(LIBITTAPI, int, thr_name_setW, (const wchar_t *name, int namelen), (ITT_FORMAT name, namelen), thr_name_setW, __itt_group_thread | __itt_group_legacy, "\"%S\", %d")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen), (ITT_FORMAT name, namelen), thr_name_set, __itt_group_thread | __itt_group_legacy, "\"%s\", %d")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(LIBITTAPI, void, thr_ignore, (void), (ITT_NO_PARAMS), thr_ignore, __itt_group_thread | __itt_group_legacy, "no args")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
ITT_STUBV(ITTAPI, void, enable_attach, (void), (ITT_NO_PARAMS), enable_attach, __itt_group_all, "no args")
|
||||
|
||||
#else /* __ITT_INTERNAL_INIT */
|
||||
|
||||
ITT_STUBV(ITTAPI, void, detach, (void), (ITT_NO_PARAMS), detach, __itt_group_control | __itt_group_legacy, "no args")
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, sync_createA, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_createA, __itt_group_sync | __itt_group_fsync, "%p, \"%s\", \"%s\", %x")
|
||||
ITT_STUBV(ITTAPI, void, sync_createW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_createW, __itt_group_sync | __itt_group_fsync, "%p, \"%S\", \"%S\", %x")
|
||||
ITT_STUBV(ITTAPI, void, sync_renameA, (void *addr, const char *name), (ITT_FORMAT addr, name), sync_renameA, __itt_group_sync | __itt_group_fsync, "%p, \"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, sync_renameW, (void *addr, const wchar_t *name), (ITT_FORMAT addr, name), sync_renameW, __itt_group_sync | __itt_group_fsync, "%p, \"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, sync_create, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_create, __itt_group_sync | __itt_group_fsync, "%p, \"%s\", \"%s\", %x")
|
||||
ITT_STUBV(ITTAPI, void, sync_rename, (void *addr, const char *name), (ITT_FORMAT addr, name), sync_rename, __itt_group_sync | __itt_group_fsync, "%p, \"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, sync_destroy, (void *addr), (ITT_FORMAT addr), sync_destroy, __itt_group_sync | __itt_group_fsync, "%p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, sync_prepare, (void* addr), (ITT_FORMAT addr), sync_prepare, __itt_group_sync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, sync_cancel, (void *addr), (ITT_FORMAT addr), sync_cancel, __itt_group_sync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, sync_acquired, (void *addr), (ITT_FORMAT addr), sync_acquired, __itt_group_sync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, sync_releasing, (void* addr), (ITT_FORMAT addr), sync_releasing, __itt_group_sync, "%p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, suppress_push, (unsigned int mask), (ITT_FORMAT mask), suppress_push, __itt_group_suppress, "%p")
|
||||
ITT_STUBV(ITTAPI, void, suppress_pop, (void), (ITT_NO_PARAMS), suppress_pop, __itt_group_suppress, "no args")
|
||||
ITT_STUBV(ITTAPI, void, suppress_mark_range, (__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size),(ITT_FORMAT mode, mask, address, size), suppress_mark_range, __itt_group_suppress, "%d, %p, %p, %d")
|
||||
ITT_STUBV(ITTAPI, void, suppress_clear_range,(__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size),(ITT_FORMAT mode, mask, address, size), suppress_clear_range,__itt_group_suppress, "%d, %p, %p, %d")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, fsync_prepare, (void* addr), (ITT_FORMAT addr), sync_prepare, __itt_group_fsync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, fsync_cancel, (void *addr), (ITT_FORMAT addr), sync_cancel, __itt_group_fsync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, fsync_acquired, (void *addr), (ITT_FORMAT addr), sync_acquired, __itt_group_fsync, "%p")
|
||||
ITT_STUBV(ITTAPI, void, fsync_releasing, (void* addr), (ITT_FORMAT addr), sync_releasing, __itt_group_fsync, "%p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, model_site_begin, (__itt_model_site *site, __itt_model_site_instance *instance, const char *name), (ITT_FORMAT site, instance, name), model_site_begin, __itt_group_model, "%p, %p, \"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_site_end, (__itt_model_site *site, __itt_model_site_instance *instance), (ITT_FORMAT site, instance), model_site_end, __itt_group_model, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, model_task_begin, (__itt_model_task *task, __itt_model_task_instance *instance, const char *name), (ITT_FORMAT task, instance, name), model_task_begin, __itt_group_model, "%p, %p, \"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_task_end, (__itt_model_task *task, __itt_model_task_instance *instance), (ITT_FORMAT task, instance), model_task_end, __itt_group_model, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, model_lock_acquire, (void *lock), (ITT_FORMAT lock), model_lock_acquire, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_lock_release, (void *lock), (ITT_FORMAT lock), model_lock_release, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_record_allocation, (void *addr, size_t size), (ITT_FORMAT addr, size), model_record_allocation, __itt_group_model, "%p, %d")
|
||||
ITT_STUBV(ITTAPI, void, model_record_deallocation, (void *addr), (ITT_FORMAT addr), model_record_deallocation, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_induction_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_induction_uses, __itt_group_model, "%p, %d")
|
||||
ITT_STUBV(ITTAPI, void, model_reduction_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_reduction_uses, __itt_group_model, "%p, %d")
|
||||
ITT_STUBV(ITTAPI, void, model_observe_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_observe_uses, __itt_group_model, "%p, %d")
|
||||
ITT_STUBV(ITTAPI, void, model_clear_uses, (void* addr), (ITT_FORMAT addr), model_clear_uses, __itt_group_model, "%p")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, model_site_beginW, (const wchar_t *name), (ITT_FORMAT name), model_site_beginW, __itt_group_model, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_task_beginW, (const wchar_t *name), (ITT_FORMAT name), model_task_beginW, __itt_group_model, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_iteration_taskW, (const wchar_t *name), (ITT_FORMAT name), model_iteration_taskW, __itt_group_model, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, model_site_beginA, (const char *name), (ITT_FORMAT name), model_site_beginA, __itt_group_model, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_site_beginAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_site_beginAL, __itt_group_model, "\"%s\", %d")
|
||||
ITT_STUBV(ITTAPI, void, model_task_beginA, (const char *name), (ITT_FORMAT name), model_task_beginA, __itt_group_model, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_task_beginAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_task_beginAL, __itt_group_model, "\"%s\", %d")
|
||||
ITT_STUBV(ITTAPI, void, model_iteration_taskA, (const char *name), (ITT_FORMAT name), model_iteration_taskA, __itt_group_model, "\"%s\"")
|
||||
ITT_STUBV(ITTAPI, void, model_iteration_taskAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_iteration_taskAL, __itt_group_model, "\"%s\", %d")
|
||||
ITT_STUBV(ITTAPI, void, model_site_end_2, (void), (ITT_NO_PARAMS), model_site_end_2, __itt_group_model, "no args")
|
||||
ITT_STUBV(ITTAPI, void, model_task_end_2, (void), (ITT_NO_PARAMS), model_task_end_2, __itt_group_model, "no args")
|
||||
ITT_STUBV(ITTAPI, void, model_lock_acquire_2, (void *lock), (ITT_FORMAT lock), model_lock_acquire_2, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_lock_release_2, (void *lock), (ITT_FORMAT lock), model_lock_release_2, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_aggregate_task, (size_t count), (ITT_FORMAT count), model_aggregate_task, __itt_group_model, "%d")
|
||||
ITT_STUBV(ITTAPI, void, model_disable_push, (__itt_model_disable x), (ITT_FORMAT x), model_disable_push, __itt_group_model, "%p")
|
||||
ITT_STUBV(ITTAPI, void, model_disable_pop, (void), (ITT_NO_PARAMS), model_disable_pop, __itt_group_model, "no args")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createA, (const char *name, const char *domain), (ITT_FORMAT name, domain), heap_function_createA, __itt_group_heap, "\"%s\", \"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createW, (const wchar_t *name, const wchar_t *domain), (ITT_FORMAT name, domain), heap_function_createW, __itt_group_heap, "\"%s\", \"%s\"")
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_heap_function, heap_function_create, (const char *name, const char *domain), (ITT_FORMAT name, domain), heap_function_create, __itt_group_heap, "\"%s\", \"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
ITT_STUBV(ITTAPI, void, heap_allocate_begin, (__itt_heap_function h, size_t size, int initialized), (ITT_FORMAT h, size, initialized), heap_allocate_begin, __itt_group_heap, "%p, %lu, %d")
|
||||
ITT_STUBV(ITTAPI, void, heap_allocate_end, (__itt_heap_function h, void** addr, size_t size, int initialized), (ITT_FORMAT h, addr, size, initialized), heap_allocate_end, __itt_group_heap, "%p, %p, %lu, %d")
|
||||
ITT_STUBV(ITTAPI, void, heap_free_begin, (__itt_heap_function h, void* addr), (ITT_FORMAT h, addr), heap_free_begin, __itt_group_heap, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, heap_free_end, (__itt_heap_function h, void* addr), (ITT_FORMAT h, addr), heap_free_end, __itt_group_heap, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, heap_reallocate_begin, (__itt_heap_function h, void* addr, size_t new_size, int initialized), (ITT_FORMAT h, addr, new_size, initialized), heap_reallocate_begin, __itt_group_heap, "%p, %p, %lu, %d")
|
||||
ITT_STUBV(ITTAPI, void, heap_reallocate_end, (__itt_heap_function h, void* addr, void** new_addr, size_t new_size, int initialized), (ITT_FORMAT h, addr, new_addr, new_size, initialized), heap_reallocate_end, __itt_group_heap, "%p, %p, %p, %lu, %d")
|
||||
ITT_STUBV(ITTAPI, void, heap_internal_access_begin, (void), (ITT_NO_PARAMS), heap_internal_access_begin, __itt_group_heap, "no args")
|
||||
ITT_STUBV(ITTAPI, void, heap_internal_access_end, (void), (ITT_NO_PARAMS), heap_internal_access_end, __itt_group_heap, "no args")
|
||||
ITT_STUBV(ITTAPI, void, heap_record_memory_growth_begin, (void), (ITT_NO_PARAMS), heap_record_memory_growth_begin, __itt_group_heap, "no args")
|
||||
ITT_STUBV(ITTAPI, void, heap_record_memory_growth_end, (void), (ITT_NO_PARAMS), heap_record_memory_growth_end, __itt_group_heap, "no args")
|
||||
ITT_STUBV(ITTAPI, void, heap_reset_detection, (unsigned int reset_mask), (ITT_FORMAT reset_mask), heap_reset_detection, __itt_group_heap, "%u")
|
||||
ITT_STUBV(ITTAPI, void, heap_record, (unsigned int record_mask), (ITT_FORMAT record_mask), heap_record, __itt_group_heap, "%u")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, id_create, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), id_create, __itt_group_structure, "%p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, id_destroy, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), id_destroy, __itt_group_structure, "%p, %lu")
|
||||
|
||||
ITT_STUB(ITTAPI, __itt_timestamp, get_timestamp, (void), (ITT_NO_PARAMS), get_timestamp, __itt_group_structure, "no args")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, region_begin, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), region_begin, __itt_group_structure, "%p, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, region_end, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), region_end, __itt_group_structure, "%p, %lu")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
ITT_STUBV(ITTAPI, void, frame_begin_v3, (const __itt_domain *domain, __itt_id *id), (ITT_FORMAT domain, id), frame_begin_v3, __itt_group_structure, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, frame_end_v3, (const __itt_domain *domain, __itt_id *id), (ITT_FORMAT domain, id), frame_end_v3, __itt_group_structure, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, frame_submit_v3, (const __itt_domain *domain, __itt_id *id, __itt_timestamp begin, __itt_timestamp end), (ITT_FORMAT domain, id, begin, end), frame_submit_v3, __itt_group_structure, "%p, %p, %lu, %lu")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
ITT_STUBV(ITTAPI, void, task_group, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_group, __itt_group_structure, "%p, %lu, %lu, %p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, task_begin, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_begin, __itt_group_structure, "%p, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_begin_fn, (const __itt_domain *domain, __itt_id id, __itt_id parent, void* fn), (ITT_FORMAT domain, id, parent, fn), task_begin_fn, __itt_group_structure, "%p, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_end, (const __itt_domain *domain), (ITT_FORMAT domain), task_end, __itt_group_structure, "%p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, counter_inc_v3, (const __itt_domain *domain, __itt_string_handle *name), (ITT_FORMAT domain, name), counter_inc_v3, __itt_group_structure, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, counter_inc_delta_v3, (const __itt_domain *domain, __itt_string_handle *name, unsigned long long value), (ITT_FORMAT domain, name, value), counter_inc_delta_v3, __itt_group_structure, "%p, %p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, counter_dec_v3, (const __itt_domain *domain, __itt_string_handle *name), (ITT_FORMAT domain, name), counter_dec_v3, __itt_group_structure, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, counter_dec_delta_v3, (const __itt_domain *domain, __itt_string_handle *name, unsigned long long value), (ITT_FORMAT domain, name, value), counter_dec_delta_v3, __itt_group_structure, "%p, %p, %lu")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, marker, (const __itt_domain *domain, __itt_id id, __itt_string_handle *name, __itt_scope scope), (ITT_FORMAT domain, id, name, scope), marker, __itt_group_structure, "%p, %lu, %p, %d")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, metadata_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data), (ITT_FORMAT domain, id, key, type, count, data), metadata_add, __itt_group_structure, "%p, %lu, %p, %d, %lu, %p")
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_addA, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_addA, __itt_group_structure, "%p, %lu, %p, %p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_addW, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const wchar_t* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_addW, __itt_group_structure, "%p, %lu, %p, %p, %lu")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_add, __itt_group_structure, "%p, %lu, %p, %p, %lu")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
ITT_STUBV(ITTAPI, void, relation_add_to_current, (const __itt_domain *domain, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, relation, tail), relation_add_to_current, __itt_group_structure, "%p, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, relation_add, (const __itt_domain *domain, __itt_id head, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, head, relation, tail), relation_add, __itt_group_structure, "%p, %p, %lu, %p")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen), (ITT_FORMAT name, namelen), event_createA, __itt_group_mark | __itt_group_legacy, "\"%s\", %d")
|
||||
ITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen), (ITT_FORMAT name, namelen), event_createW, __itt_group_mark | __itt_group_legacy, "\"%S\", %d")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen), (ITT_FORMAT name, namelen), event_create, __itt_group_mark | __itt_group_legacy, "\"%s\", %d")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(LIBITTAPI, int, event_start, (__itt_event event), (ITT_FORMAT event), event_start, __itt_group_mark | __itt_group_legacy, "%d")
|
||||
ITT_STUB(LIBITTAPI, int, event_end, (__itt_event event), (ITT_FORMAT event), event_end, __itt_group_mark | __itt_group_legacy, "%d")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, sync_set_nameA, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_nameA, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", \"%s\", %x")
|
||||
ITT_STUBV(ITTAPI, void, sync_set_nameW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_nameW, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%S\", \"%S\", %x")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, sync_set_name, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_name, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "p, \"%s\", \"%s\", %x")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(LIBITTAPI, int, notify_sync_nameA, (void *p, const char *objtype, int typelen, const char *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_nameA, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", %d, \"%s\", %d, %x")
|
||||
ITT_STUB(LIBITTAPI, int, notify_sync_nameW, (void *p, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_nameW, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%S\", %d, \"%S\", %d, %x")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(LIBITTAPI, int, notify_sync_name, (void *p, const char *objtype, int typelen, const char *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_name, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", %d, \"%s\", %d, %x")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
ITT_STUBV(LIBITTAPI, void, notify_sync_prepare, (void *p), (ITT_FORMAT p), notify_sync_prepare, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p")
|
||||
ITT_STUBV(LIBITTAPI, void, notify_sync_cancel, (void *p), (ITT_FORMAT p), notify_sync_cancel, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p")
|
||||
ITT_STUBV(LIBITTAPI, void, notify_sync_acquired, (void *p), (ITT_FORMAT p), notify_sync_acquired, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p")
|
||||
ITT_STUBV(LIBITTAPI, void, notify_sync_releasing, (void *p), (ITT_FORMAT p), notify_sync_releasing, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
ITT_STUBV(LIBITTAPI, void, memory_read, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_read, __itt_group_legacy, "%p, %lu")
|
||||
ITT_STUBV(LIBITTAPI, void, memory_write, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_write, __itt_group_legacy, "%p, %lu")
|
||||
ITT_STUBV(LIBITTAPI, void, memory_update, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_update, __itt_group_legacy, "%p, %lu")
|
||||
|
||||
ITT_STUB(LIBITTAPI, __itt_state_t, state_get, (void), (ITT_NO_PARAMS), state_get, __itt_group_legacy, "no args")
|
||||
ITT_STUB(LIBITTAPI, __itt_state_t, state_set, (__itt_state_t s), (ITT_FORMAT s), state_set, __itt_group_legacy, "%d")
|
||||
ITT_STUB(LIBITTAPI, __itt_obj_state_t, obj_mode_set, (__itt_obj_prop_t p, __itt_obj_state_t s), (ITT_FORMAT p, s), obj_mode_set, __itt_group_legacy, "%d, %d")
|
||||
ITT_STUB(LIBITTAPI, __itt_thr_state_t, thr_mode_set, (__itt_thr_prop_t p, __itt_thr_state_t s), (ITT_FORMAT p, s), thr_mode_set, __itt_group_legacy, "%d, %d")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_frame, frame_createA, (const char *domain), (ITT_FORMAT domain), frame_createA, __itt_group_frame, "\"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_frame, frame_createW, (const wchar_t *domain), (ITT_FORMAT domain), frame_createW, __itt_group_frame, "\"%s\"")
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_frame, frame_create, (const char *domain), (ITT_FORMAT domain), frame_create, __itt_group_frame, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
ITT_STUBV(ITTAPI, void, frame_begin, (__itt_frame frame), (ITT_FORMAT frame), frame_begin, __itt_group_frame, "%p")
|
||||
ITT_STUBV(ITTAPI, void, frame_end, (__itt_frame frame), (ITT_FORMAT frame), frame_end, __itt_group_frame, "%p")
|
||||
|
||||
ITT_STUBV(ITTAPI, void, counter_destroy, (__itt_counter id), (ITT_FORMAT id), counter_destroy, __itt_group_counter, "%p")
|
||||
ITT_STUBV(ITTAPI, void, counter_inc, (__itt_counter id), (ITT_FORMAT id), counter_inc, __itt_group_counter, "%p")
|
||||
ITT_STUBV(ITTAPI, void, counter_inc_delta, (__itt_counter id, unsigned long long value), (ITT_FORMAT id, value), counter_inc_delta, __itt_group_counter, "%p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, counter_dec, (__itt_counter id), (ITT_FORMAT id), counter_dec, __itt_group_counter, "%p")
|
||||
ITT_STUBV(ITTAPI, void, counter_dec_delta, (__itt_counter id, unsigned long long value), (ITT_FORMAT id, value), counter_dec_delta, __itt_group_counter, "%p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, counter_set_value, (__itt_counter id, void *value_ptr), (ITT_FORMAT id, value_ptr), counter_set_value, __itt_group_counter, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, counter_set_value_ex, (__itt_counter id, __itt_clock_domain *clock_domain, unsigned long long timestamp, void *value_ptr), (ITT_FORMAT id, clock_domain, timestamp, value_ptr), counter_set_value_ex, __itt_group_counter, "%p, %p, %llu, %p")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, __itt_mark_type, mark_createA, (const char *name), (ITT_FORMAT name), mark_createA, __itt_group_mark, "\"%s\"")
|
||||
ITT_STUB(ITTAPI, __itt_mark_type, mark_createW, (const wchar_t *name), (ITT_FORMAT name), mark_createW, __itt_group_mark, "\"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, __itt_mark_type, mark_create, (const char *name), (ITT_FORMAT name), mark_create, __itt_group_mark, "\"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, int, markA, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), markA, __itt_group_mark, "%d, \"%s\"")
|
||||
ITT_STUB(ITTAPI, int, markW, (__itt_mark_type mt, const wchar_t *parameter), (ITT_FORMAT mt, parameter), markW, __itt_group_mark, "%d, \"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, int, mark, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark, __itt_group_mark, "%d, \"%s\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, int, mark_off, (__itt_mark_type mt), (ITT_FORMAT mt), mark_off, __itt_group_mark, "%d")
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, int, mark_globalA, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark_globalA, __itt_group_mark, "%d, \"%s\"")
|
||||
ITT_STUB(ITTAPI, int, mark_globalW, (__itt_mark_type mt, const wchar_t *parameter), (ITT_FORMAT mt, parameter), mark_globalW, __itt_group_mark, "%d, \"%S\"")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, int, mark_global, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark_global, __itt_group_mark, "%d, \"%S\"")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, int, mark_global_off, (__itt_mark_type mt), (ITT_FORMAT mt), mark_global_off, __itt_group_mark, "%d")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
ITT_STUB(ITTAPI, __itt_caller, stack_caller_create, (void), (ITT_NO_PARAMS), stack_caller_create, __itt_group_stitch, "no args")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
ITT_STUBV(ITTAPI, void, stack_caller_destroy, (__itt_caller id), (ITT_FORMAT id), stack_caller_destroy, __itt_group_stitch, "%p")
|
||||
ITT_STUBV(ITTAPI, void, stack_callee_enter, (__itt_caller id), (ITT_FORMAT id), stack_callee_enter, __itt_group_stitch, "%p")
|
||||
ITT_STUBV(ITTAPI, void, stack_callee_leave, (__itt_caller id), (ITT_FORMAT id), stack_callee_leave, __itt_group_stitch, "%p")
|
||||
|
||||
ITT_STUB(ITTAPI, __itt_clock_domain*, clock_domain_create, (__itt_get_clock_info_fn fn, void* fn_data), (ITT_FORMAT fn, fn_data), clock_domain_create, __itt_group_structure, "%p, %p")
|
||||
ITT_STUBV(ITTAPI, void, clock_domain_reset, (void), (ITT_NO_PARAMS), clock_domain_reset, __itt_group_structure, "no args")
|
||||
ITT_STUBV(ITTAPI, void, id_create_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), id_create_ex, __itt_group_structure, "%p, %p, %lu, %lu")
|
||||
ITT_STUBV(ITTAPI, void, id_destroy_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), id_destroy_ex, __itt_group_structure, "%p, %p, %lu, %lu")
|
||||
ITT_STUBV(ITTAPI, void, task_begin_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, __itt_string_handle *name), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, name), task_begin_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_begin_fn_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, void* fn), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, fn), task_begin_fn_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_end_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp), (ITT_FORMAT domain, clock_domain, timestamp), task_end_ex, __itt_group_structure, "%p, %p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, task_begin_overlapped, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_begin_overlapped, __itt_group_structure, "%p, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_begin_overlapped_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, __itt_string_handle *name), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, name), task_begin_overlapped_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p")
|
||||
ITT_STUBV(ITTAPI, void, task_end_overlapped, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), task_end_overlapped, __itt_group_structure, "%p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, task_end_overlapped_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), task_end_overlapped_ex, __itt_group_structure, "%p, %p, %lu, %lu")
|
||||
ITT_STUBV(ITTAPI, void, marker_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_string_handle *name, __itt_scope scope), (ITT_FORMAT domain, clock_domain, timestamp, id, name, scope), marker_ex, __itt_group_structure, "%p, %p, %lu, %lu, %p, %d")
|
||||
ITT_STUBV(ITTAPI, void, metadata_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data), (ITT_FORMAT domain, scope, key, type, count, data), metadata_add_with_scope, __itt_group_structure, "%p, %d, %p, %d, %lu, %p")
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeA, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scopeA, __itt_group_structure, "%p, %d, %p, %p, %lu")
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeW, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const wchar_t *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scopeW, __itt_group_structure, "%p, %d, %p, %p, %lu")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, metadata_str_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scope, __itt_group_structure, "%p, %d, %p, %p, %lu")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, relation_add_to_current_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, clock_domain, timestamp, relation, tail), relation_add_to_current_ex, __itt_group_structure, "%p, %p, %lu, %d, %lu")
|
||||
ITT_STUBV(ITTAPI, void, relation_add_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id head, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, clock_domain, timestamp, head, relation, tail), relation_add_ex, __itt_group_structure, "%p, %p, %lu, %lu, %d, %lu")
|
||||
ITT_STUB(ITTAPI, __itt_track_group*, track_group_create, (__itt_string_handle* name, __itt_track_group_type track_group_type), (ITT_FORMAT name, track_group_type), track_group_create, __itt_group_structure, "%p, %d")
|
||||
ITT_STUB(ITTAPI, __itt_track*, track_create, (__itt_track_group* track_group,__itt_string_handle* name, __itt_track_type track_type), (ITT_FORMAT track_group, name, track_type), track_create, __itt_group_structure, "%p, %p, %d")
|
||||
ITT_STUBV(ITTAPI, void, set_track, (__itt_track *track), (ITT_FORMAT track), set_track, __itt_group_structure, "%p")
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
ITT_STUB(ITTAPI, const char*, api_version, (void), (ITT_NO_PARAMS), api_version, __itt_group_all & ~__itt_group_legacy, "no args")
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUB(ITTAPI, int, av_saveA, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_saveA, __itt_group_arrays, "%p, %d, %p, %d, \"%s\", %d")
|
||||
ITT_STUB(ITTAPI, int, av_saveW, (void *data, int rank, const int *dimensions, int type, const wchar_t *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_saveW, __itt_group_arrays, "%p, %d, %p, %d, \"%S\", %d")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUB(ITTAPI, int, av_save, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_save, __itt_group_arrays, "%p, %d, %p, %d, \"%s\", %d")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
#ifndef __ITT_INTERNAL_BODY
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
ITT_STUBV(ITTAPI, void, module_loadA, (void *start_addr, void* end_addr, const char *path), (ITT_FORMAT start_addr, end_addr, path), module_loadA, __itt_group_none, "%p, %p, %p")
|
||||
ITT_STUBV(ITTAPI, void, module_loadW, (void *start_addr, void* end_addr, const wchar_t *path), (ITT_FORMAT start_addr, end_addr, path), module_loadW, __itt_group_none, "%p, %p, %p")
|
||||
#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
|
||||
ITT_STUBV(ITTAPI, void, module_load, (void *start_addr, void *end_addr, const char *path), (ITT_FORMAT start_addr, end_addr, path), module_load, __itt_group_none, "%p, %p, %p")
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#endif /* __ITT_INTERNAL_BODY */
|
||||
|
||||
|
||||
#endif /* __ITT_INTERNAL_INIT */
|
115
3rdparty/ittnotify/src/ittnotify/ittnotify_types.h
vendored
Normal file
115
3rdparty/ittnotify/src/ittnotify/ittnotify_types.h
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#ifndef _ITTNOTIFY_TYPES_H_
|
||||
#define _ITTNOTIFY_TYPES_H_
|
||||
|
||||
typedef enum ___itt_group_id
|
||||
{
|
||||
__itt_group_none = 0,
|
||||
__itt_group_legacy = 1<<0,
|
||||
__itt_group_control = 1<<1,
|
||||
__itt_group_thread = 1<<2,
|
||||
__itt_group_mark = 1<<3,
|
||||
__itt_group_sync = 1<<4,
|
||||
__itt_group_fsync = 1<<5,
|
||||
__itt_group_jit = 1<<6,
|
||||
__itt_group_model = 1<<7,
|
||||
__itt_group_splitter_min = 1<<7,
|
||||
__itt_group_counter = 1<<8,
|
||||
__itt_group_frame = 1<<9,
|
||||
__itt_group_stitch = 1<<10,
|
||||
__itt_group_heap = 1<<11,
|
||||
__itt_group_splitter_max = 1<<12,
|
||||
__itt_group_structure = 1<<12,
|
||||
__itt_group_suppress = 1<<13,
|
||||
__itt_group_arrays = 1<<14,
|
||||
__itt_group_all = -1
|
||||
} __itt_group_id;
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
typedef struct ___itt_group_list
|
||||
{
|
||||
__itt_group_id id;
|
||||
const char* name;
|
||||
} __itt_group_list;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define ITT_GROUP_LIST(varname) \
|
||||
static __itt_group_list varname[] = { \
|
||||
{ __itt_group_all, "all" }, \
|
||||
{ __itt_group_control, "control" }, \
|
||||
{ __itt_group_thread, "thread" }, \
|
||||
{ __itt_group_mark, "mark" }, \
|
||||
{ __itt_group_sync, "sync" }, \
|
||||
{ __itt_group_fsync, "fsync" }, \
|
||||
{ __itt_group_jit, "jit" }, \
|
||||
{ __itt_group_model, "model" }, \
|
||||
{ __itt_group_counter, "counter" }, \
|
||||
{ __itt_group_frame, "frame" }, \
|
||||
{ __itt_group_stitch, "stitch" }, \
|
||||
{ __itt_group_heap, "heap" }, \
|
||||
{ __itt_group_structure, "structure" }, \
|
||||
{ __itt_group_suppress, "suppress" }, \
|
||||
{ __itt_group_arrays, "arrays" }, \
|
||||
{ __itt_group_none, NULL } \
|
||||
}
|
||||
|
||||
#endif /* _ITTNOTIFY_TYPES_H_ */
|
314
3rdparty/ittnotify/src/ittnotify/jitprofiling.c
vendored
Normal file
314
3rdparty/ittnotify/src/ittnotify/jitprofiling.c
vendored
Normal file
@ -0,0 +1,314 @@
|
||||
/* <copyright>
|
||||
This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
redistributing this file, you may do so under either license.
|
||||
|
||||
GPL LICENSE SUMMARY
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
The full GNU General Public License is included in this distribution
|
||||
in the file called LICENSE.GPL.
|
||||
|
||||
Contact Information:
|
||||
http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
|
||||
|
||||
BSD LICENSE
|
||||
|
||||
Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</copyright> */
|
||||
|
||||
#include "ittnotify_config.h"
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
#include <windows.h>
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
#if ITT_PLATFORM != ITT_PLATFORM_MAC && ITT_PLATFORM != ITT_PLATFORM_FREEBSD
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "jitprofiling.h"
|
||||
|
||||
static const char rcsid[] = "\n@(#) $Revision: 471937 $\n";
|
||||
|
||||
#define DLL_ENVIRONMENT_VAR "VS_PROFILER"
|
||||
|
||||
#ifndef NEW_DLL_ENVIRONMENT_VAR
|
||||
#if ITT_ARCH==ITT_ARCH_IA32
|
||||
#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER32"
|
||||
#else
|
||||
#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER64"
|
||||
#endif
|
||||
#endif /* NEW_DLL_ENVIRONMENT_VAR */
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
#define DEFAULT_DLLNAME "JitPI.dll"
|
||||
HINSTANCE m_libHandle = NULL;
|
||||
#elif ITT_PLATFORM==ITT_PLATFORM_MAC
|
||||
#define DEFAULT_DLLNAME "libJitPI.dylib"
|
||||
void* m_libHandle = NULL;
|
||||
#else
|
||||
#define DEFAULT_DLLNAME "libJitPI.so"
|
||||
void* m_libHandle = NULL;
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
/* default location of JIT profiling agent on Android */
|
||||
#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so"
|
||||
|
||||
/* the function pointers */
|
||||
typedef unsigned int(JITAPI *TPInitialize)(void);
|
||||
static TPInitialize FUNC_Initialize=NULL;
|
||||
|
||||
typedef unsigned int(JITAPI *TPNotify)(unsigned int, void*);
|
||||
static TPNotify FUNC_NotifyEvent=NULL;
|
||||
|
||||
static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING;
|
||||
|
||||
/* end collector dll part. */
|
||||
|
||||
/* loadiJIT_Funcs() : this function is called just in the beginning
|
||||
* and is responsible to load the functions from BistroJavaCollector.dll
|
||||
* result:
|
||||
* on success: the functions loads, iJIT_DLL_is_missing=0, return value = 1
|
||||
* on failure: the functions are NULL, iJIT_DLL_is_missing=1, return value = 0
|
||||
*/
|
||||
static int loadiJIT_Funcs(void);
|
||||
|
||||
/* global representing whether the collector can't be loaded */
|
||||
static int iJIT_DLL_is_missing = 0;
|
||||
|
||||
ITT_EXTERN_C int JITAPI
|
||||
iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData)
|
||||
{
|
||||
int ReturnValue = 0;
|
||||
|
||||
/* initialization part - the collector has not been loaded yet. */
|
||||
if (!FUNC_NotifyEvent)
|
||||
{
|
||||
if (iJIT_DLL_is_missing)
|
||||
return 0;
|
||||
|
||||
if (!loadiJIT_Funcs())
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED ||
|
||||
event_type == iJVM_EVENT_TYPE_METHOD_UPDATE)
|
||||
{
|
||||
if (((piJIT_Method_Load)EventSpecificData)->method_id == 0)
|
||||
return 0;
|
||||
}
|
||||
else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2)
|
||||
{
|
||||
if (((piJIT_Method_Load_V2)EventSpecificData)->method_id == 0)
|
||||
return 0;
|
||||
}
|
||||
else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3)
|
||||
{
|
||||
if (((piJIT_Method_Load_V3)EventSpecificData)->method_id == 0)
|
||||
return 0;
|
||||
}
|
||||
else if (event_type == iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED)
|
||||
{
|
||||
if (((piJIT_Method_Inline_Load)EventSpecificData)->method_id == 0 ||
|
||||
((piJIT_Method_Inline_Load)EventSpecificData)->parent_method_id == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData);
|
||||
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive()
|
||||
{
|
||||
if (!iJIT_DLL_is_missing)
|
||||
{
|
||||
loadiJIT_Funcs();
|
||||
}
|
||||
|
||||
return executionMode;
|
||||
}
|
||||
|
||||
/* This function loads the collector dll and the relevant functions.
|
||||
* on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1
|
||||
* on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0
|
||||
*/
|
||||
static int loadiJIT_Funcs()
|
||||
{
|
||||
static int bDllWasLoaded = 0;
|
||||
char *dllName = (char*)rcsid; /* !! Just to avoid unused code elimination */
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
DWORD dNameLength = 0;
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
if(bDllWasLoaded)
|
||||
{
|
||||
/* dll was already loaded, no need to do it for the second time */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Assumes that the DLL will not be found */
|
||||
iJIT_DLL_is_missing = 1;
|
||||
FUNC_NotifyEvent = NULL;
|
||||
|
||||
if (m_libHandle)
|
||||
{
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
FreeLibrary(m_libHandle);
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
dlclose(m_libHandle);
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
m_libHandle = NULL;
|
||||
}
|
||||
|
||||
/* Try to get the dll name from the environment */
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
dNameLength = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, NULL, 0);
|
||||
if (dNameLength)
|
||||
{
|
||||
DWORD envret = 0;
|
||||
dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
|
||||
if(dllName != NULL)
|
||||
{
|
||||
envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR,
|
||||
dllName, dNameLength);
|
||||
if (envret)
|
||||
{
|
||||
/* Try to load the dll from the PATH... */
|
||||
m_libHandle = LoadLibraryExA(dllName,
|
||||
NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
}
|
||||
free(dllName);
|
||||
}
|
||||
} else {
|
||||
/* Try to use old VS_PROFILER variable */
|
||||
dNameLength = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, NULL, 0);
|
||||
if (dNameLength)
|
||||
{
|
||||
DWORD envret = 0;
|
||||
dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
|
||||
if(dllName != NULL)
|
||||
{
|
||||
envret = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR,
|
||||
dllName, dNameLength);
|
||||
if (envret)
|
||||
{
|
||||
/* Try to load the dll from the PATH... */
|
||||
m_libHandle = LoadLibraryA(dllName);
|
||||
}
|
||||
free(dllName);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
dllName = getenv(NEW_DLL_ENVIRONMENT_VAR);
|
||||
if (!dllName)
|
||||
dllName = getenv(DLL_ENVIRONMENT_VAR);
|
||||
#if defined(__ANDROID__) || defined(ANDROID)
|
||||
if (!dllName)
|
||||
dllName = ANDROID_JIT_AGENT_PATH;
|
||||
#endif
|
||||
if (dllName)
|
||||
{
|
||||
/* Try to load the dll from the PATH... */
|
||||
m_libHandle = dlopen(dllName, RTLD_LAZY);
|
||||
}
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
|
||||
if (!m_libHandle)
|
||||
{
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
m_libHandle = LoadLibraryA(DEFAULT_DLLNAME);
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY);
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
}
|
||||
|
||||
/* if the dll wasn't loaded - exit. */
|
||||
if (!m_libHandle)
|
||||
{
|
||||
iJIT_DLL_is_missing = 1; /* don't try to initialize
|
||||
* JIT agent the second time
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent");
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
FUNC_NotifyEvent = (TPNotify)dlsym(m_libHandle, "NotifyEvent");
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
if (!FUNC_NotifyEvent)
|
||||
{
|
||||
FUNC_Initialize = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if ITT_PLATFORM==ITT_PLATFORM_WIN
|
||||
FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize");
|
||||
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
FUNC_Initialize = (TPInitialize)dlsym(m_libHandle, "Initialize");
|
||||
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
|
||||
if (!FUNC_Initialize)
|
||||
{
|
||||
FUNC_NotifyEvent = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize();
|
||||
|
||||
bDllWasLoaded = 1;
|
||||
iJIT_DLL_is_missing = 0; /* DLL is ok. */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID()
|
||||
{
|
||||
static unsigned int methodID = 1;
|
||||
|
||||
if (methodID == 0)
|
||||
return 0; /* ERROR : this is not a valid value */
|
||||
|
||||
return methodID++;
|
||||
}
|
@ -264,6 +264,7 @@ OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
|
||||
OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" ON IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_LAPACK "Include Lapack library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_ITT "Include Intel ITT support" ON IF (NOT APPLE_FRAMEWORK) )
|
||||
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
@ -291,6 +292,7 @@ OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 O
|
||||
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (WIN32 OR ANDROID OR APPLE) AND NOT WINRT)
|
||||
OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID )
|
||||
OCV_OPTION(BUILD_IPP_IW "Build IPP IW from source" NOT MINGW IF (X86_64 OR X86) AND NOT WINRT )
|
||||
OCV_OPTION(BUILD_ITT "Build Intel ITT from source" NOT MINGW IF (X86_64 OR X86) AND NOT WINRT AND NOT APPLE_FRAMEWORK )
|
||||
|
||||
# OpenCV installation options
|
||||
# ===================================================
|
||||
@ -324,7 +326,7 @@ OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binarie
|
||||
OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
|
||||
OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
|
||||
OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
|
||||
|
||||
OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
|
||||
|
||||
|
||||
if(ENABLE_IMPL_COLLECTION)
|
||||
@ -733,6 +735,16 @@ if(HAVE_CUDA)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Code trace support
|
||||
# ----------------------------------------------------------------------------
|
||||
if(CV_TRACE)
|
||||
include(cmake/OpenCVDetectTrace.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Solution folders:
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -1278,6 +1290,14 @@ endif()
|
||||
status("")
|
||||
status(" Parallel framework:" TRUE THEN "${CV_PARALLEL_FRAMEWORK}" ELSE NO)
|
||||
|
||||
if(CV_TRACE OR OPENCV_TRACE)
|
||||
set(__msg "")
|
||||
if(HAVE_ITT)
|
||||
set(__msg "with Intel ITT")
|
||||
endif()
|
||||
status("")
|
||||
status(" Trace: " OPENCV_TRACE THEN "YES (${__msg})" ELSE NO)
|
||||
endif()
|
||||
|
||||
# ========================== Other third-party libraries ==========================
|
||||
status("")
|
||||
|
@ -1,4 +1,6 @@
|
||||
add_definitions(-D__OPENCV_BUILD=1)
|
||||
add_definitions(-D__OPENCV_APPS=1)
|
||||
|
||||
link_libraries(${OPENCV_LINKER_LIBS})
|
||||
|
||||
add_subdirectory(traincascade)
|
||||
|
@ -5,9 +5,15 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/core/utils/trace.hpp>
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
CV_TRACE_ARG(argc);
|
||||
CV_TRACE_ARG_VALUE(argv0, "argv0", argv[0]);
|
||||
CV_TRACE_ARG_VALUE(argv1, "argv1", argv[1]);
|
||||
|
||||
cv::CommandLineParser parser(argc, argv,
|
||||
"{ help h usage ? | | show this help message }"
|
||||
"{ verbose v | | show build configuration log }"
|
||||
|
13
cmake/OpenCVDetectTrace.cmake
Normal file
13
cmake/OpenCVDetectTrace.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
if(WITH_ITT)
|
||||
if(BUILD_ITT)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/ittnotify")
|
||||
set(ITT_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/ittnotify/include")
|
||||
set(ITT_INCLUDE_DIRS "${ITT_INCLUDE_DIR}")
|
||||
set(ITT_LIBRARIES "ittnotify")
|
||||
set(HAVE_ITT 1)
|
||||
else()
|
||||
#TODO
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OPENCV_TRACE 1)
|
@ -683,6 +683,8 @@ macro(ocv_glob_module_sources)
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/hal/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/hal/*.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/utils/*.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/utils/*.h"
|
||||
)
|
||||
file(GLOB lib_hdrs_detail
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/detail/*.hpp"
|
||||
@ -927,7 +929,7 @@ macro(_ocv_create_module)
|
||||
if(OPENCV_MODULE_${m}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${m};")
|
||||
foreach(hdr ${OPENCV_MODULE_${m}_HEADERS})
|
||||
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
|
||||
if(NOT hdr2 MATCHES "opencv2/${m}/private.*" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" )
|
||||
if(NOT hdr2 MATCHES "private" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" )
|
||||
install(FILES ${hdr} OPTIONAL DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
|
||||
endif()
|
||||
endforeach()
|
||||
@ -1158,6 +1160,8 @@ function(ocv_add_accuracy_tests)
|
||||
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
|
||||
)
|
||||
|
||||
ocv_append_target_property(${the_target} COMPILE_DEFINITIONS "__OPENCV_TESTS=1")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "tests accuracy")
|
||||
endif()
|
||||
|
@ -241,5 +241,8 @@
|
||||
#define HAVE_VIDEO_OUTPUT
|
||||
#endif
|
||||
|
||||
/* OpenCV trace utilities */
|
||||
#cmakedefine OPENCV_TRACE
|
||||
|
||||
|
||||
#endif // OPENCV_CVCONFIG_H_INCLUDED
|
||||
|
@ -789,8 +789,11 @@ TEST(Calib3d_StereoSGBM_HH4, regression)
|
||||
{
|
||||
String path = cvtest::TS::ptr()->get_data_path() + "cv/stereomatching/datasets/teddy/";
|
||||
Mat leftImg = imread(path + "im2.png", 0);
|
||||
ASSERT_FALSE(leftImg.empty());
|
||||
Mat rightImg = imread(path + "im6.png", 0);
|
||||
ASSERT_FALSE(rightImg.empty());
|
||||
Mat testData = imread(path + "disp2_hh4.png",-1);
|
||||
ASSERT_FALSE(testData.empty());
|
||||
Mat leftDisp;
|
||||
Mat toCheck;
|
||||
{
|
||||
|
@ -21,6 +21,10 @@ if(HAVE_CUDA)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function -Wshadow)
|
||||
endif()
|
||||
|
||||
if(CV_TRACE AND HAVE_ITT AND BUILD_ITT)
|
||||
add_definitions(-DOPENCV_WITH_ITT=1)
|
||||
endif()
|
||||
|
||||
file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h")
|
||||
file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "include/opencv2/${name}/cuda/detail/*.h")
|
||||
|
||||
@ -37,9 +41,16 @@ if(ANDROID AND HAVE_CPUFEATURES)
|
||||
ocv_append_sourge_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/system.cpp "HAVE_CPUFEATURES=1")
|
||||
ocv_module_include_directories(${CPUFEATURES_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(ITT_INCLUDE_DIRS)
|
||||
ocv_module_include_directories(${ITT_INCLUDE_DIRS})
|
||||
endif()
|
||||
ocv_create_module(${extra_libs})
|
||||
|
||||
ocv_target_link_libraries(${the_module} ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}" "${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}")
|
||||
ocv_target_link_libraries(${the_module}
|
||||
"${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}"
|
||||
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}"
|
||||
"${ITT_LIBRARIES}"
|
||||
)
|
||||
|
||||
ocv_add_accuracy_tests()
|
||||
ocv_add_perf_tests()
|
||||
|
@ -51,6 +51,11 @@
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4127 )
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
#ifndef OPENCV_NOSTL
|
||||
@ -233,14 +238,7 @@ template<typename _Tp, int n> static inline
|
||||
std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec)
|
||||
{
|
||||
out << "[";
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4127 )
|
||||
#endif
|
||||
if(Vec<_Tp, n>::depth < CV_32F)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
{
|
||||
for (int i = 0; i < n - 1; ++i) {
|
||||
out << (int)vec[i] << ", ";
|
||||
@ -285,6 +283,10 @@ static inline std::ostream& operator << (std::ostream& out, const MatSize& msize
|
||||
#endif // OPENCV_NOSTL
|
||||
} // cv
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
//! @endcond
|
||||
|
||||
#endif // OPENCV_CORE_CVSTDINL_HPP
|
||||
|
@ -49,6 +49,11 @@
|
||||
# error mat.inl.hpp header must be compiled as C++
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4127 )
|
||||
#endif
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
@ -3855,4 +3860,8 @@ inline UMatDataAutoLock::~UMatDataAutoLock() { u->unlock(); }
|
||||
|
||||
} //cv
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -51,6 +51,8 @@
|
||||
#include "opencv2/core.hpp"
|
||||
#include "cvconfig.h"
|
||||
|
||||
#include <opencv2/core/utils/trace.hpp>
|
||||
|
||||
#ifdef HAVE_EIGEN
|
||||
# if defined __GNUC__ && defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wshadow"
|
||||
@ -548,6 +550,7 @@ static struct __IppInitializer__ __ipp_initializer__;
|
||||
{ \
|
||||
if (cv::ipp::useIPP() && (condition)) \
|
||||
{ \
|
||||
CV__TRACE_REGION_("IPP:" #func, CV_TRACE_NS::details::REGION_FLAG_IMPL_IPP) \
|
||||
if(func) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
@ -562,23 +565,21 @@ static struct __IppInitializer__ __ipp_initializer__;
|
||||
}
|
||||
#else
|
||||
#define CV_IPP_RUN_(condition, func, ...) \
|
||||
if (cv::ipp::useIPP() && (condition) && (func)) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return __VA_ARGS__; \
|
||||
}
|
||||
if (cv::ipp::useIPP() && (condition)) \
|
||||
{ \
|
||||
CV__TRACE_REGION_("IPP:" #func, CV_TRACE_NS::details::REGION_FLAG_IMPL_IPP) \
|
||||
if(func) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
#define CV_IPP_RUN_FAST(func, ...) \
|
||||
if (cv::ipp::useIPP() && (func)) \
|
||||
{ \
|
||||
CV_IMPL_ADD(CV_IMPL_IPP); \
|
||||
return __VA_ARGS__; \
|
||||
}
|
||||
#else
|
||||
#define CV_IPP_RUN_(condition, func, ...)
|
||||
#define CV_IPP_RUN_FAST(func, ...)
|
||||
#endif
|
||||
|
||||
#define CV_IPP_RUN_FAST(func, ...) CV_IPP_RUN_(true, func, __VA_ARGS__)
|
||||
#define CV_IPP_RUN(condition, func, ...) CV_IPP_RUN_((condition), (func), __VA_ARGS__)
|
||||
|
||||
|
||||
@ -768,15 +769,15 @@ CV_EXPORTS InstrNode* getCurrentNode();
|
||||
#else
|
||||
#define CV_INSTRUMENT_REGION_META(...)
|
||||
|
||||
#define CV_INSTRUMENT_REGION_()
|
||||
#define CV_INSTRUMENT_REGION_NAME(...)
|
||||
#define CV_INSTRUMENT_REGION_() CV_TRACE_FUNCTION()
|
||||
#define CV_INSTRUMENT_REGION_NAME(...) CV_TRACE_REGION(__VA_ARGS__)
|
||||
#define CV_INSTRUMENT_REGION_MT_FORK()
|
||||
|
||||
#define CV_INSTRUMENT_REGION_IPP()
|
||||
#define CV_INSTRUMENT_REGION_IPP() CV__TRACE_REGION_("IPP", CV_TRACE_NS::details::REGION_FLAG_IMPL_IPP)
|
||||
#define CV_INSTRUMENT_FUN_IPP(FUN, ...) ((FUN)(__VA_ARGS__))
|
||||
#define CV_INSTRUMENT_MARK_IPP(...)
|
||||
|
||||
#define CV_INSTRUMENT_REGION_OPENCL()
|
||||
#define CV_INSTRUMENT_REGION_OPENCL() CV__TRACE_REGION_("OpenCL", CV_TRACE_NS::details::REGION_FLAG_IMPL_OPENCL)
|
||||
#define CV_INSTRUMENT_REGION_OPENCL_COMPILE(...)
|
||||
#define CV_INSTRUMENT_REGION_OPENCL_RUN(...)
|
||||
#define CV_INSTRUMENT_MARK_OPENCL(...)
|
||||
|
@ -641,6 +641,7 @@ public:
|
||||
inline TLSData() {}
|
||||
inline ~TLSData() { release(); } // Release key and delete associated data
|
||||
inline T* get() const { return (T*)getData(); } // Get data associated with key
|
||||
inline T& getRef() const { T* ptr = (T*)getData(); CV_Assert(ptr); return *ptr; } // Get data associated with key
|
||||
|
||||
// Get data from all threads
|
||||
inline void gather(std::vector<T*> &data) const
|
||||
@ -1168,6 +1169,12 @@ static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); }
|
||||
CV_EXPORTS FLAGS getFlags();
|
||||
}
|
||||
|
||||
namespace utils {
|
||||
|
||||
CV_EXPORTS int getThreadID();
|
||||
|
||||
} // namespace
|
||||
|
||||
} //namespace cv
|
||||
|
||||
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
|
||||
|
84
modules/core/include/opencv2/core/utils/logger.hpp
Normal file
84
modules/core/include/opencv2/core/utils/logger.hpp
Normal file
@ -0,0 +1,84 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_LOGGING_HPP
|
||||
#define OPENCV_LOGGING_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <limits.h> // INT_MAX
|
||||
|
||||
// TODO This file contains just interface part with implementation stubs.
|
||||
|
||||
//! @addtogroup core_logging
|
||||
// This section describes OpenCV logging utilities.
|
||||
//
|
||||
//! @{
|
||||
|
||||
namespace utils {
|
||||
namespace logging {
|
||||
|
||||
// Supported logging levels and their semantic
|
||||
#define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogVevel() call
|
||||
#define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error)
|
||||
#define CV_LOG_LEVEL_ERROR 2 //!< Error message
|
||||
#define CV_LOG_LEVEL_WARN 3 //!< Warning message
|
||||
#define CV_LOG_LEVEL_INFO 4 //!< Info message
|
||||
#define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build.
|
||||
#define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
|
||||
|
||||
//! Supported logging levels and their semantic
|
||||
enum LogLevel {
|
||||
LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call
|
||||
LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error)
|
||||
LOG_LEVEL_ERROR = 2, //!< Error message
|
||||
LOG_LEVEL_WARNING = 3, //!< Warning message
|
||||
LOG_LEVEL_INFO = 4, //!< Info message
|
||||
LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build.
|
||||
LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
|
||||
#ifndef CV_DOXYGEN
|
||||
ENUM_LOG_LEVEL_FORCE_INT = INT_MAX
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \def CV_LOG_STRIP_LEVEL
|
||||
*
|
||||
* Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|DISABLED] to compile out anything at that and before that logging level
|
||||
*/
|
||||
#ifndef CV_LOG_STRIP_LEVEL
|
||||
# if defined NDEBUG
|
||||
# define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG
|
||||
# else
|
||||
# define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#define CV_LOG_FATAL(tag, ...) for(;;) { std::stringstream ss; ss << "[FATAL:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cerr << ss.str(); break; }
|
||||
#define CV_LOG_ERROR(tag, ...) for(;;) { std::stringstream ss; ss << "[ERROR:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cerr << ss.str(); break; }
|
||||
#define CV_LOG_WARNING(tag, ...) for(;;) { std::stringstream ss; ss << "[ WARN:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; }
|
||||
#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO
|
||||
#define CV_LOG_INFO(tag, ...)
|
||||
#else
|
||||
#define CV_LOG_INFO(tag, ...) for(;;) { std::stringstream ss; ss << "[ INFO:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; }
|
||||
#endif
|
||||
#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG
|
||||
#define CV_LOG_DEBUG(tag, ...)
|
||||
#else
|
||||
#define CV_LOG_DEBUG(tag, ...) for(;;) { std::stringstream ss; ss << "[DEBUG:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; }
|
||||
#endif
|
||||
#if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE
|
||||
#define CV_LOG_VERBOSE(tag, v, ...)
|
||||
#else
|
||||
#define CV_LOG_VERBOSE(tag, v, ...) for(;;) { std::stringstream ss; ss << "[VERB" << v << ":" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; }
|
||||
#endif
|
||||
|
||||
|
||||
}} // namespace
|
||||
|
||||
//! @}
|
||||
|
||||
#endif // OPENCV_LOGGING_HPP
|
250
modules/core/include/opencv2/core/utils/trace.hpp
Normal file
250
modules/core/include/opencv2/core/utils/trace.hpp
Normal file
@ -0,0 +1,250 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_TRACE_HPP
|
||||
#define OPENCV_TRACE_HPP
|
||||
|
||||
#include <opencv2/core/cvdef.h>
|
||||
|
||||
//! @addtogroup core_logging
|
||||
// This section describes OpenCV tracing utilities.
|
||||
//
|
||||
//! @{
|
||||
|
||||
namespace cv {
|
||||
namespace utils {
|
||||
namespace trace {
|
||||
|
||||
//! Macro to trace function
|
||||
#define CV_TRACE_FUNCTION()
|
||||
|
||||
#define CV_TRACE_FUNCTION_SKIP_NESTED()
|
||||
|
||||
//! Trace code scope.
|
||||
//! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "initialize".
|
||||
#define CV_TRACE_REGION(name_as_static_string_literal)
|
||||
//! mark completed of the current opened region and create new one
|
||||
//! @note Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "step1".
|
||||
#define CV_TRACE_REGION_NEXT(name_as_static_string_literal)
|
||||
|
||||
//! Macro to trace argument value
|
||||
#define CV_TRACE_ARG(arg_id)
|
||||
|
||||
//! Macro to trace argument value (expanded version)
|
||||
#define CV_TRACE_ARG_VALUE(arg_id, arg_name, value)
|
||||
|
||||
//! @cond IGNORED
|
||||
#define CV_TRACE_NS cv::utils::trace
|
||||
|
||||
namespace details {
|
||||
|
||||
#ifndef __OPENCV_TRACE
|
||||
# if defined __OPENCV_BUILD && !defined __OPENCV_TESTS && !defined __OPENCV_APPS
|
||||
# define __OPENCV_TRACE 1
|
||||
# else
|
||||
# define __OPENCV_TRACE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CV_TRACE_FILENAME
|
||||
# define CV_TRACE_FILENAME __FILE__
|
||||
#endif
|
||||
|
||||
#ifndef CV__TRACE_FUNCTION
|
||||
# if defined _MSC_VER
|
||||
# define CV__TRACE_FUNCTION __FUNCSIG__
|
||||
# elif defined __GNUC__
|
||||
# define CV__TRACE_FUNCTION __PRETTY_FUNCTION__
|
||||
# else
|
||||
# define CV__TRACE_FUNCTION "<unknown>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//! Thread-local instance (usually allocated on stack)
|
||||
class CV_EXPORTS Region
|
||||
{
|
||||
public:
|
||||
struct LocationExtraData;
|
||||
struct LocationStaticStorage
|
||||
{
|
||||
LocationExtraData** ppExtra; //< implementation specific data
|
||||
const char* name; //< region name (function name or other custom name)
|
||||
const char* filename; //< source code filename
|
||||
int line; //< source code line
|
||||
int flags; //< flags (implementation code path: Plain, IPP, OpenCL)
|
||||
};
|
||||
|
||||
Region(const LocationStaticStorage& location);
|
||||
inline ~Region()
|
||||
{
|
||||
if (implFlags != 0)
|
||||
destroy();
|
||||
CV_DbgAssert(implFlags == 0);
|
||||
CV_DbgAssert(pImpl == NULL);
|
||||
}
|
||||
|
||||
class Impl;
|
||||
Impl* pImpl; // NULL if current region is not active
|
||||
int implFlags; // see RegionFlag, 0 if region is ignored
|
||||
|
||||
bool isActive() const { return pImpl != NULL; }
|
||||
|
||||
void destroy();
|
||||
private:
|
||||
Region(const Region&); // disabled
|
||||
Region& operator= (const Region&); // disabled
|
||||
};
|
||||
|
||||
//! Specify region flags
|
||||
enum RegionLocationFlag {
|
||||
REGION_FLAG_FUNCTION = (1 << 0), //< region is function (=1) / nested named region (=0)
|
||||
REGION_FLAG_APP_CODE = (1 << 1), //< region is Application code (=1) / OpenCV library code (=0)
|
||||
REGION_FLAG_SKIP_NESTED = (1 << 2), //< avoid processing of nested regions
|
||||
|
||||
REGION_FLAG_IMPL_IPP = (1 << 16), //< region is part of IPP code path
|
||||
REGION_FLAG_IMPL_OPENCL = (2 << 16), //< region is part of OpenCL code path
|
||||
REGION_FLAG_IMPL_OPENVX = (3 << 16), //< region is part of OpenVX code path
|
||||
|
||||
REGION_FLAG_IMPL_MASK = (15 << 16),
|
||||
|
||||
REGION_FLAG_REGION_FORCE = (1 << 30),
|
||||
REGION_FLAG_REGION_NEXT = (1 << 31), //< close previous region (see #CV_TRACE_REGION_NEXT macro)
|
||||
|
||||
ENUM_REGION_FLAG_FORCE_INT = INT_MAX
|
||||
};
|
||||
|
||||
struct CV_EXPORTS TraceArg {
|
||||
public:
|
||||
struct ExtraData;
|
||||
ExtraData** ppExtra;
|
||||
const char* name;
|
||||
int flags;
|
||||
};
|
||||
/** @brief Add meta information to current region (function)
|
||||
* See CV_TRACE_ARG macro
|
||||
* @param arg argument information structure (global static cache)
|
||||
* @param value argument value (can by dynamic string literal in case of string, static allocation is not required)
|
||||
*/
|
||||
CV_EXPORTS void traceArg(const TraceArg& arg, const char* value);
|
||||
//! @overload
|
||||
CV_EXPORTS void traceArg(const TraceArg& arg, int value);
|
||||
//! @overload
|
||||
CV_EXPORTS void traceArg(const TraceArg& arg, int64 value);
|
||||
//! @overload
|
||||
CV_EXPORTS void traceArg(const TraceArg& arg, double value);
|
||||
|
||||
#define CV__TRACE_LOCATION_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_, loc_id), __LINE__)
|
||||
#define CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_extra_, loc_id) , __LINE__)
|
||||
|
||||
#define CV__TRACE_DEFINE_LOCATION_(loc_id, name, flags) \
|
||||
static CV_TRACE_NS::details::Region::LocationExtraData* CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) = 0; \
|
||||
static const CV_TRACE_NS::details::Region::LocationStaticStorage \
|
||||
CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags};
|
||||
|
||||
#define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, (flags | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
|
||||
|
||||
|
||||
#define CV__TRACE_OPENCV_FUNCTION() \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, 0); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
#define CV__TRACE_OPENCV_FUNCTION_NAME(name) \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(name, 0); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
#define CV__TRACE_APP_FUNCTION() \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
#define CV__TRACE_APP_FUNCTION_NAME(name) \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
|
||||
#define CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED() \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
#define CV__TRACE_OPENCV_FUNCTION_NAME_SKIP_NESTED(name) \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
#define CV__TRACE_APP_FUNCTION_SKIP_NESTED() \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED | CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
|
||||
#define CV__TRACE_REGION_(name_as_static_string_literal, flags) \
|
||||
CV__TRACE_DEFINE_LOCATION_(region, name_as_static_string_literal, flags); \
|
||||
CV_TRACE_NS::details::Region CVAUX_CONCAT(__region_, __LINE__)(CV__TRACE_LOCATION_VARNAME(region));
|
||||
|
||||
#define CV__TRACE_REGION(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, 0)
|
||||
#define CV__TRACE_REGION_NEXT(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, CV_TRACE_NS::details::REGION_FLAG_REGION_NEXT)
|
||||
|
||||
#define CV__TRACE_ARG_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_ ## arg_id, __LINE__)
|
||||
#define CV__TRACE_ARG_EXTRA_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_extra_ ## arg_id, __LINE__)
|
||||
|
||||
#define CV__TRACE_DEFINE_ARG_(arg_id, name, flags) \
|
||||
static CV_TRACE_NS::details::TraceArg::ExtraData* CV__TRACE_ARG_EXTRA_VARNAME(arg_id) = 0; \
|
||||
static const CV_TRACE_NS::details::TraceArg \
|
||||
CV__TRACE_ARG_VARNAME(arg_id) = { &(CV__TRACE_ARG_EXTRA_VARNAME(arg_id)), name, flags };
|
||||
|
||||
#define CV__TRACE_ARG_VALUE(arg_id, arg_name, value) \
|
||||
CV__TRACE_DEFINE_ARG_(arg_id, arg_name, 0); \
|
||||
CV_TRACE_NS::details::traceArg((CV__TRACE_ARG_VARNAME(arg_id)), value);
|
||||
|
||||
#define CV__TRACE_ARG(arg_id) CV_TRACE_ARG_VALUE(arg_id, #arg_id, (arg_id))
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifndef OPENCV_DISABLE_TRACE
|
||||
#undef CV_TRACE_FUNCTION
|
||||
#undef CV_TRACE_FUNCTION_SKIP_NESTED
|
||||
#if __OPENCV_TRACE
|
||||
#define CV_TRACE_FUNCTION CV__TRACE_OPENCV_FUNCTION
|
||||
#define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED
|
||||
#else
|
||||
#define CV_TRACE_FUNCTION CV__TRACE_APP_FUNCTION
|
||||
#define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_APP_FUNCTION_SKIP_NESTED
|
||||
#endif
|
||||
|
||||
#undef CV_TRACE_REGION
|
||||
#define CV_TRACE_REGION CV__TRACE_REGION
|
||||
|
||||
#undef CV_TRACE_REGION_NEXT
|
||||
#define CV_TRACE_REGION_NEXT CV__TRACE_REGION_NEXT
|
||||
|
||||
#undef CV_TRACE_ARG_VALUE
|
||||
#define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) \
|
||||
if (__region_fn.isActive()) \
|
||||
{ \
|
||||
CV__TRACE_ARG_VALUE(arg_id, arg_name, value); \
|
||||
}
|
||||
|
||||
#undef CV_TRACE_ARG
|
||||
#define CV_TRACE_ARG CV__TRACE_ARG
|
||||
|
||||
#endif // OPENCV_DISABLE_TRACE
|
||||
|
||||
#ifdef OPENCV_TRACE_VERBOSE
|
||||
#define CV_TRACE_FUNCTION_VERBOSE CV_TRACE_FUNCTION
|
||||
#define CV_TRACE_REGION_VERBOSE CV_TRACE_REGION
|
||||
#define CV_TRACE_REGION_NEXT_VERBOSE CV_TRACE_REGION_NEXT
|
||||
#define CV_TRACE_ARG_VALUE_VERBOSE CV_TRACE_ARG_VALUE
|
||||
#define CV_TRACE_ARG_VERBOSE CV_TRACE_ARG
|
||||
#else
|
||||
#define CV_TRACE_FUNCTION_VERBOSE(...)
|
||||
#define CV_TRACE_REGION_VERBOSE(...)
|
||||
#define CV_TRACE_REGION_NEXT_VERBOSE(...)
|
||||
#define CV_TRACE_ARG_VALUE_VERBOSE(...)
|
||||
#define CV_TRACE_ARG_VERBOSE(...)
|
||||
#endif
|
||||
|
||||
//! @endcond
|
||||
|
||||
}}} // namespace
|
||||
|
||||
//! @}
|
||||
|
||||
#endif // OPENCV_TRACE_HPP
|
419
modules/core/include/opencv2/core/utils/trace.private.hpp
Normal file
419
modules/core/include/opencv2/core/utils/trace.private.hpp
Normal file
@ -0,0 +1,419 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef OPENCV_TRACE_PRIVATE_HPP
|
||||
#define OPENCV_TRACE_PRIVATE_HPP
|
||||
|
||||
#ifdef OPENCV_TRACE
|
||||
|
||||
#include <opencv2/core/utils/logger.hpp>
|
||||
|
||||
#include "trace.hpp"
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
#include <deque>
|
||||
#include <ostream>
|
||||
|
||||
#define INTEL_ITTNOTIFY_API_PRIVATE 1
|
||||
#ifdef OPENCV_WITH_ITT
|
||||
#include "ittnotify.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_ONLY
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_ONLY(...) __VA_ARGS__
|
||||
#else
|
||||
#define DEBUG_ONLY(...) (void)0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_ONLY_
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_ONLY_(...) __VA_ARGS__
|
||||
#else
|
||||
#define DEBUG_ONLY_(...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace cv {
|
||||
namespace utils {
|
||||
namespace trace {
|
||||
namespace details {
|
||||
|
||||
#define CV__TRACE_OPENCV_FUNCTION_NAME_(name, flags) \
|
||||
CV__TRACE_DEFINE_LOCATION_FN(name, flags); \
|
||||
const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
|
||||
|
||||
|
||||
enum RegionFlag {
|
||||
REGION_FLAG__NEED_STACK_POP = (1 << 0),
|
||||
REGION_FLAG__ACTIVE = (1 << 1),
|
||||
|
||||
ENUM_REGION_FLAG_IMPL_FORCE_INT = INT_MAX
|
||||
};
|
||||
|
||||
|
||||
class TraceMessage;
|
||||
|
||||
class TraceStorage {
|
||||
public:
|
||||
TraceStorage() {}
|
||||
virtual ~TraceStorage() {};
|
||||
|
||||
virtual bool put(const TraceMessage& msg) const = 0;
|
||||
};
|
||||
|
||||
struct RegionStatistics
|
||||
{
|
||||
int currentSkippedRegions;
|
||||
|
||||
int64 duration;
|
||||
#ifdef HAVE_IPP
|
||||
int64 durationImplIPP;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
int64 durationImplOpenCL;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
int64 durationImplOpenVX;
|
||||
#endif
|
||||
|
||||
RegionStatistics() :
|
||||
currentSkippedRegions(0),
|
||||
duration(0)
|
||||
#ifdef HAVE_IPP
|
||||
,durationImplIPP(0)
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
,durationImplOpenCL(0)
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
,durationImplOpenVX(0)
|
||||
#endif
|
||||
{}
|
||||
|
||||
void grab(RegionStatistics& result)
|
||||
{
|
||||
result.currentSkippedRegions = currentSkippedRegions; currentSkippedRegions = 0;
|
||||
result.duration = duration; duration = 0;
|
||||
#ifdef HAVE_IPP
|
||||
result.durationImplIPP = durationImplIPP; durationImplIPP = 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
result.durationImplOpenCL = durationImplOpenCL; durationImplOpenCL = 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
result.durationImplOpenVX = durationImplOpenVX; durationImplOpenVX = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void append(RegionStatistics& stat)
|
||||
{
|
||||
currentSkippedRegions += stat.currentSkippedRegions;
|
||||
duration += stat.duration;
|
||||
#ifdef HAVE_IPP
|
||||
durationImplIPP += stat.durationImplIPP;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
durationImplOpenCL += stat.durationImplOpenCL;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
durationImplOpenVX += stat.durationImplOpenVX;
|
||||
#endif
|
||||
}
|
||||
|
||||
void multiply(const float c)
|
||||
{
|
||||
duration = (int64)(duration * c);
|
||||
#ifdef HAVE_IPP
|
||||
durationImplIPP = (int64)(durationImplIPP * c);
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
durationImplOpenCL = (int64)(durationImplOpenCL * c);
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
durationImplOpenVX = (int64)(durationImplOpenVX * c);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
static inline
|
||||
std::ostream& operator<<(std::ostream& out, const RegionStatistics& stat)
|
||||
{
|
||||
out << "skip=" << stat.currentSkippedRegions
|
||||
<< " duration=" << stat.duration
|
||||
#ifdef HAVE_IPP
|
||||
<< " durationImplIPP=" << stat.durationImplIPP
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
<< " durationImplOpenCL=" << stat.durationImplOpenCL
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
<< " durationImplOpenVX=" << stat.durationImplOpenVX
|
||||
#endif
|
||||
;
|
||||
return out;
|
||||
}
|
||||
|
||||
struct RegionStatisticsStatus
|
||||
{
|
||||
int _skipDepth;
|
||||
#ifdef HAVE_IPP
|
||||
int ignoreDepthImplIPP;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
int ignoreDepthImplOpenCL;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
int ignoreDepthImplOpenVX;
|
||||
#endif
|
||||
|
||||
RegionStatisticsStatus() { reset(); }
|
||||
|
||||
void reset()
|
||||
{
|
||||
_skipDepth = -1;
|
||||
#ifdef HAVE_IPP
|
||||
ignoreDepthImplIPP = 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
ignoreDepthImplOpenCL = 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
ignoreDepthImplOpenVX = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void propagateFrom(const RegionStatisticsStatus& src)
|
||||
{
|
||||
_skipDepth = -1;
|
||||
if (src._skipDepth >= 0)
|
||||
enableSkipMode(0);
|
||||
#ifdef HAVE_IPP
|
||||
ignoreDepthImplIPP = src.ignoreDepthImplIPP ? 1 : 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
ignoreDepthImplOpenCL = src.ignoreDepthImplOpenCL ? 1 : 0;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
ignoreDepthImplOpenVX = src.ignoreDepthImplOpenVX ? 1 : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void enableSkipMode(int depth);
|
||||
void checkResetSkipMode(int leaveDepth);
|
||||
};
|
||||
|
||||
static inline
|
||||
std::ostream& operator<<(std::ostream& out, const RegionStatisticsStatus& s)
|
||||
{
|
||||
out << "ignore={";
|
||||
if (s._skipDepth >= 0)
|
||||
out << " SKIP=" << s._skipDepth;
|
||||
#ifdef HAVE_IPP
|
||||
if (s.ignoreDepthImplIPP)
|
||||
out << " IPP=" << s.ignoreDepthImplIPP;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
if (s.ignoreDepthImplOpenCL)
|
||||
out << " OpenCL=" << s.ignoreDepthImplOpenCL;
|
||||
#endif
|
||||
#ifdef HAVE_OPENVX
|
||||
if (s.ignoreDepthImplOpenVX)
|
||||
out << " OpenVX=" << s.ignoreDepthImplOpenVX;
|
||||
#endif
|
||||
out << "}";
|
||||
return out;
|
||||
}
|
||||
|
||||
//! TraceManager for local thread
|
||||
struct TraceManagerThreadLocal
|
||||
{
|
||||
const int threadID;
|
||||
int region_counter;
|
||||
|
||||
size_t totalSkippedEvents;
|
||||
|
||||
Region* currentActiveRegion;
|
||||
|
||||
struct StackEntry
|
||||
{
|
||||
Region* region;
|
||||
const Region::LocationStaticStorage* location;
|
||||
int64 beginTimestamp;
|
||||
StackEntry(Region* region_, const Region::LocationStaticStorage* location_, int64 beginTimestamp_) :
|
||||
region(region_), location(location_), beginTimestamp(beginTimestamp_)
|
||||
{}
|
||||
StackEntry() : region(NULL), location(NULL), beginTimestamp(-1) {}
|
||||
};
|
||||
std::deque<StackEntry> stack;
|
||||
|
||||
int regionDepth; // functions only (no named regions)
|
||||
int regionDepthOpenCV; // functions from OpenCV library
|
||||
|
||||
RegionStatistics stat;
|
||||
RegionStatisticsStatus stat_status;
|
||||
|
||||
StackEntry dummy_stack_top; // parallel_for root region
|
||||
RegionStatistics parallel_for_stat;
|
||||
RegionStatisticsStatus parallel_for_stat_status;
|
||||
size_t parallel_for_stack_size;
|
||||
|
||||
|
||||
mutable cv::Ptr<TraceStorage> storage;
|
||||
|
||||
TraceManagerThreadLocal() :
|
||||
threadID(cv::utils::getThreadID()),
|
||||
region_counter(0), totalSkippedEvents(0),
|
||||
currentActiveRegion(NULL),
|
||||
regionDepth(0),
|
||||
regionDepthOpenCV(0),
|
||||
parallel_for_stack_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
~TraceManagerThreadLocal();
|
||||
|
||||
TraceStorage* getStorage() const;
|
||||
|
||||
void recordLocation(const Region::LocationStaticStorage& location);
|
||||
void recordRegionEnter(const Region& region);
|
||||
void recordRegionLeave(const Region& region, const RegionStatistics& result);
|
||||
void recordRegionArg(const Region& region, const TraceArg& arg, const char& value);
|
||||
|
||||
inline void stackPush(Region* region, const Region::LocationStaticStorage* location, int64 beginTimestamp)
|
||||
{
|
||||
stack.push_back(StackEntry(region, location, beginTimestamp));
|
||||
}
|
||||
inline Region* stackTopRegion() const
|
||||
{
|
||||
if (stack.empty())
|
||||
return dummy_stack_top.region;
|
||||
return stack.back().region;
|
||||
}
|
||||
inline const Region::LocationStaticStorage* stackTopLocation() const
|
||||
{
|
||||
if (stack.empty())
|
||||
return dummy_stack_top.location;
|
||||
return stack.back().location;
|
||||
}
|
||||
inline int64 stackTopBeginTimestamp() const
|
||||
{
|
||||
if (stack.empty())
|
||||
return dummy_stack_top.beginTimestamp;
|
||||
return stack.back().beginTimestamp;
|
||||
}
|
||||
inline void stackPop()
|
||||
{
|
||||
CV_DbgAssert(!stack.empty());
|
||||
stack.pop_back();
|
||||
}
|
||||
void dumpStack(std::ostream& out, bool onlyFunctions) const;
|
||||
|
||||
inline Region* getCurrentActiveRegion()
|
||||
{
|
||||
return currentActiveRegion;
|
||||
}
|
||||
|
||||
inline int getCurrentDepth() const { return (int)stack.size(); }
|
||||
};
|
||||
|
||||
class CV_EXPORTS TraceManager
|
||||
{
|
||||
public:
|
||||
TraceManager();
|
||||
~TraceManager();
|
||||
|
||||
static bool isActivated();
|
||||
|
||||
Mutex mutexCreate;
|
||||
Mutex mutexCount;
|
||||
|
||||
TLSData<TraceManagerThreadLocal> tls;
|
||||
|
||||
cv::Ptr<TraceStorage> trace_storage;
|
||||
private:
|
||||
// disable copying
|
||||
TraceManager(const TraceManager&);
|
||||
TraceManager& operator=(const TraceManager&);
|
||||
};
|
||||
|
||||
CV_EXPORTS TraceManager& getTraceManager();
|
||||
inline Region* getCurrentActiveRegion() { return getTraceManager().tls.get()->getCurrentActiveRegion(); }
|
||||
inline Region* getCurrentRegion() { return getTraceManager().tls.get()->stackTopRegion(); }
|
||||
|
||||
void parallelForSetRootRegion(const Region& rootRegion, const TraceManagerThreadLocal& root_ctx);
|
||||
void parallelForAttachNestedRegion(const Region& rootRegion);
|
||||
void parallelForFinalize(const Region& rootRegion);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct Region::LocationExtraData
|
||||
{
|
||||
int global_location_id; // 0 - region is disabled
|
||||
#ifdef OPENCV_WITH_ITT
|
||||
// Special fields for ITT
|
||||
__itt_string_handle* volatile ittHandle_name;
|
||||
__itt_string_handle* volatile ittHandle_filename;
|
||||
#endif
|
||||
LocationExtraData(const LocationStaticStorage& location);
|
||||
|
||||
static Region::LocationExtraData* init(const Region::LocationStaticStorage& location);
|
||||
};
|
||||
|
||||
class Region::Impl
|
||||
{
|
||||
public:
|
||||
const LocationStaticStorage& location;
|
||||
|
||||
Region& region;
|
||||
Region* const parentRegion;
|
||||
|
||||
const int threadID;
|
||||
const int global_region_id;
|
||||
|
||||
const int64 beginTimestamp;
|
||||
int64 endTimestamp;
|
||||
|
||||
int directChildrenCount;
|
||||
|
||||
enum OptimizationPath {
|
||||
CODE_PATH_PLAIN = 0,
|
||||
CODE_PATH_IPP,
|
||||
CODE_PATH_OPENCL,
|
||||
CODE_PATH_OPENVX
|
||||
};
|
||||
|
||||
#ifdef OPENCV_WITH_ITT
|
||||
bool itt_id_registered;
|
||||
__itt_id itt_id;
|
||||
#endif
|
||||
|
||||
Impl(TraceManagerThreadLocal& ctx, Region* parentRegion_, Region& region_, const LocationStaticStorage& location_, int64 beginTimestamp_);
|
||||
|
||||
void enterRegion(TraceManagerThreadLocal& ctx);
|
||||
void leaveRegion(TraceManagerThreadLocal& ctx);
|
||||
|
||||
void registerRegion(TraceManagerThreadLocal& ctx);
|
||||
|
||||
void release();
|
||||
protected:
|
||||
~Impl();
|
||||
};
|
||||
|
||||
|
||||
|
||||
}}}} // namespace
|
||||
|
||||
//! @endcond
|
||||
|
||||
#endif
|
||||
|
||||
#endif // OPENCV_TRACE_PRIVATE_HPP
|
@ -47,14 +47,17 @@ namespace cv
|
||||
|
||||
Algorithm::Algorithm()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
}
|
||||
|
||||
Algorithm::~Algorithm()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
}
|
||||
|
||||
void Algorithm::save(const String& filename) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
fs << getDefaultName() << "{";
|
||||
write(fs);
|
||||
@ -63,11 +66,13 @@ void Algorithm::save(const String& filename) const
|
||||
|
||||
String Algorithm::getDefaultName() const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return String("my_object");
|
||||
}
|
||||
|
||||
void Algorithm::writeFormat(FileStorage& fs) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
fs << "format" << (int)3;
|
||||
}
|
||||
|
||||
|
@ -907,7 +907,7 @@ Mat repeat(const Mat& src, int ny, int nx)
|
||||
*/
|
||||
int cv::borderInterpolate( int p, int len, int borderType )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_FUNCTION_VERBOSE();
|
||||
|
||||
if( (unsigned)p < (unsigned)len )
|
||||
;
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
|
||||
void operator()( const cv::Range& range ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const int begin = range.start;
|
||||
const int end = range.end;
|
||||
|
||||
@ -101,6 +102,7 @@ Arthur & Vassilvitskii (2007) k-means++: The Advantages of Careful Seeding
|
||||
static void generateCentersPP(const Mat& _data, Mat& _out_centers,
|
||||
int K, RNG& rng, int trials)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int i, j, k, dims = _data.cols, N = _data.rows;
|
||||
const float* data = _data.ptr<float>(0);
|
||||
size_t step = _data.step/sizeof(data[0]);
|
||||
|
@ -3130,7 +3130,7 @@ void cv::hconcat(InputArray _src, OutputArray dst)
|
||||
|
||||
void cv::vconcat(const Mat* src, size_t nsrc, OutputArray _dst)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED()
|
||||
|
||||
if( nsrc == 0 || !src )
|
||||
{
|
||||
|
@ -65,67 +65,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// TODO Move to some common place
|
||||
static bool getBoolParameter(const char* name, bool defaultValue)
|
||||
{
|
||||
/*
|
||||
* If your system doesn't support getenv(), define NO_GETENV to disable
|
||||
* this feature.
|
||||
*/
|
||||
#ifdef NO_GETENV
|
||||
const char* envValue = NULL;
|
||||
#else
|
||||
const char* envValue = getenv(name);
|
||||
#endif
|
||||
if (envValue == NULL)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
cv::String value = envValue;
|
||||
if (value == "1" || value == "True" || value == "true" || value == "TRUE")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (value == "0" || value == "False" || value == "false" || value == "FALSE")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
|
||||
}
|
||||
|
||||
|
||||
// TODO Move to some common place
|
||||
static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue)
|
||||
{
|
||||
#ifdef NO_GETENV
|
||||
const char* envValue = NULL;
|
||||
#else
|
||||
const char* envValue = getenv(name);
|
||||
#endif
|
||||
if (envValue == NULL)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
cv::String value = envValue;
|
||||
size_t pos = 0;
|
||||
for (; pos < value.size(); pos++)
|
||||
{
|
||||
if (!isdigit(value[pos]))
|
||||
break;
|
||||
}
|
||||
cv::String valueStr = value.substr(0, pos);
|
||||
cv::String suffixStr = value.substr(pos, value.length() - pos);
|
||||
int v = atoi(valueStr.c_str());
|
||||
if (suffixStr.length() == 0)
|
||||
return v;
|
||||
else if (suffixStr == "MB" || suffixStr == "Mb" || suffixStr == "mb")
|
||||
return v * 1024 * 1024;
|
||||
else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb")
|
||||
return v * 1024;
|
||||
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
|
||||
}
|
||||
|
||||
#if CV_OPENCL_SHOW_SVM_LOG
|
||||
// TODO add timestamp logging
|
||||
#define CV_OPENCL_SVM_TRACE_P printf("line %d (ocl.cpp): ", __LINE__); printf
|
||||
@ -159,7 +98,7 @@ static bool isRaiseError()
|
||||
static bool value = false;
|
||||
if (!initialized)
|
||||
{
|
||||
value = getBoolParameter("OPENCV_OPENCL_RAISE_ERROR", false);
|
||||
value = cv::utils::getConfigurationParameterBool("OPENCV_OPENCL_RAISE_ERROR", false);
|
||||
initialized = true;
|
||||
}
|
||||
return value;
|
||||
@ -1232,7 +1171,7 @@ static bool checkForceSVMUmatUsage()
|
||||
static bool force = false;
|
||||
if (!initialized)
|
||||
{
|
||||
force = getBoolParameter("OPENCV_OPENCL_SVM_FORCE_UMAT_USAGE", false);
|
||||
force = utils::getConfigurationParameterBool("OPENCV_OPENCL_SVM_FORCE_UMAT_USAGE", false);
|
||||
initialized = true;
|
||||
}
|
||||
return force;
|
||||
@ -1243,7 +1182,7 @@ static bool checkDisableSVMUMatUsage()
|
||||
static bool force = false;
|
||||
if (!initialized)
|
||||
{
|
||||
force = getBoolParameter("OPENCV_OPENCL_SVM_DISABLE_UMAT_USAGE", false);
|
||||
force = utils::getConfigurationParameterBool("OPENCV_OPENCL_SVM_DISABLE_UMAT_USAGE", false);
|
||||
initialized = true;
|
||||
}
|
||||
return force;
|
||||
@ -1254,7 +1193,7 @@ static bool checkDisableSVM()
|
||||
static bool force = false;
|
||||
if (!initialized)
|
||||
{
|
||||
force = getBoolParameter("OPENCV_OPENCL_SVM_DISABLE", false);
|
||||
force = utils::getConfigurationParameterBool("OPENCV_OPENCL_SVM_DISABLE", false);
|
||||
initialized = true;
|
||||
}
|
||||
return force;
|
||||
@ -1285,7 +1224,7 @@ static size_t getProgramCountLimit()
|
||||
static size_t count = 0;
|
||||
if (!initialized)
|
||||
{
|
||||
count = getConfigurationParameterForSize("OPENCV_OPENCL_PROGRAM_CACHE", 0);
|
||||
count = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_PROGRAM_CACHE", 0);
|
||||
initialized = true;
|
||||
}
|
||||
return count;
|
||||
@ -3195,12 +3134,12 @@ public:
|
||||
{
|
||||
size_t defaultPoolSize, poolSize;
|
||||
defaultPoolSize = ocl::Device::getDefault().isIntel() ? 1 << 27 : 0;
|
||||
poolSize = getConfigurationParameterForSize("OPENCV_OPENCL_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
poolSize = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
bufferPool.setMaxReservedSize(poolSize);
|
||||
poolSize = getConfigurationParameterForSize("OPENCV_OPENCL_HOST_PTR_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
poolSize = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_HOST_PTR_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
bufferPoolHostPtr.setMaxReservedSize(poolSize);
|
||||
#ifdef HAVE_OPENCL_SVM
|
||||
poolSize = getConfigurationParameterForSize("OPENCV_OPENCL_SVM_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
poolSize = utils::getConfigurationParameterSizeT("OPENCV_OPENCL_SVM_BUFFERPOOL_LIMIT", defaultPoolSize);
|
||||
bufferPoolSVM.setMaxReservedSize(poolSize);
|
||||
#endif
|
||||
|
||||
@ -4980,7 +4919,7 @@ bool internal::isOpenCLForced()
|
||||
static bool value = false;
|
||||
if (!initialized)
|
||||
{
|
||||
value = getBoolParameter("OPENCV_OPENCL_FORCE", false);
|
||||
value = utils::getConfigurationParameterBool("OPENCV_OPENCL_FORCE", false);
|
||||
initialized = true;
|
||||
}
|
||||
return value;
|
||||
@ -4992,7 +4931,7 @@ bool internal::isPerformanceCheckBypassed()
|
||||
static bool value = false;
|
||||
if (!initialized)
|
||||
{
|
||||
value = getBoolParameter("OPENCV_OPENCL_PERF_CHECK_BYPASS", false);
|
||||
value = utils::getConfigurationParameterBool("OPENCV_OPENCL_PERF_CHECK_BYPASS", false);
|
||||
initialized = true;
|
||||
}
|
||||
return value;
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#include <opencv2/core/utils/trace.private.hpp>
|
||||
|
||||
#if defined WIN32 || defined WINCE
|
||||
#include <windows.h>
|
||||
#undef small
|
||||
@ -163,10 +165,10 @@ namespace
|
||||
}
|
||||
#endif
|
||||
|
||||
class ParallelLoopBodyWrapper : public cv::ParallelLoopBody
|
||||
class ParallelLoopBodyWrapperContext
|
||||
{
|
||||
public:
|
||||
ParallelLoopBodyWrapper(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes) :
|
||||
ParallelLoopBodyWrapperContext(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes) :
|
||||
is_rng_used(false)
|
||||
{
|
||||
|
||||
@ -178,11 +180,16 @@ namespace
|
||||
// propagate main thread state
|
||||
rng = cv::theRNG();
|
||||
|
||||
#ifdef OPENCV_TRACE
|
||||
traceRootRegion = CV_TRACE_NS::details::getCurrentRegion();
|
||||
traceRootContext = CV_TRACE_NS::details::getTraceManager().tls.get();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
pThreadRoot = cv::instr::getInstrumentTLSStruct().pCurrentNode;
|
||||
#endif
|
||||
}
|
||||
~ParallelLoopBodyWrapper()
|
||||
~ParallelLoopBodyWrapperContext()
|
||||
{
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
for(size_t i = 0; i < pThreadRoot->m_childs.size(); i++)
|
||||
@ -198,49 +205,91 @@ namespace
|
||||
// Note: this behaviour is not equal to single-threaded mode.
|
||||
cv::theRNG().next();
|
||||
}
|
||||
}
|
||||
void operator()(const cv::Range& sr) const
|
||||
{
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
{
|
||||
cv::instr::InstrTLSStruct *pInstrTLS = &cv::instr::getInstrumentTLSStruct();
|
||||
pInstrTLS->pCurrentNode = pThreadRoot; // Initialize TLS node for thread
|
||||
}
|
||||
#ifdef OPENCV_TRACE
|
||||
if (traceRootRegion)
|
||||
CV_TRACE_NS::details::parallelForFinalize(*traceRootRegion);
|
||||
#endif
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
// propagate main thread state
|
||||
cv::theRNG() = rng;
|
||||
|
||||
cv::Range r;
|
||||
r.start = (int)(wholeRange.start +
|
||||
((uint64)sr.start*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
r.end = sr.end >= nstripes ? wholeRange.end : (int)(wholeRange.start +
|
||||
((uint64)sr.end*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
(*body)(r);
|
||||
|
||||
if (!is_rng_used && !(cv::theRNG() == rng))
|
||||
is_rng_used = true;
|
||||
}
|
||||
cv::Range stripeRange() const { return cv::Range(0, nstripes); }
|
||||
|
||||
protected:
|
||||
const cv::ParallelLoopBody* body;
|
||||
cv::Range wholeRange;
|
||||
int nstripes;
|
||||
cv::RNG rng;
|
||||
mutable bool is_rng_used;
|
||||
#ifdef OPENCV_TRACE
|
||||
CV_TRACE_NS::details::Region* traceRootRegion;
|
||||
CV_TRACE_NS::details::TraceManagerThreadLocal* traceRootContext;
|
||||
#endif
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
cv::instr::InstrNode *pThreadRoot;
|
||||
#endif
|
||||
private:
|
||||
ParallelLoopBodyWrapperContext(const ParallelLoopBodyWrapperContext&); // disabled
|
||||
ParallelLoopBodyWrapperContext& operator=(const ParallelLoopBodyWrapperContext&); // disabled
|
||||
};
|
||||
|
||||
class ParallelLoopBodyWrapper : public cv::ParallelLoopBody
|
||||
{
|
||||
public:
|
||||
ParallelLoopBodyWrapper(ParallelLoopBodyWrapperContext& ctx_) :
|
||||
ctx(ctx_)
|
||||
{
|
||||
}
|
||||
~ParallelLoopBodyWrapper()
|
||||
{
|
||||
}
|
||||
void operator()(const cv::Range& sr) const
|
||||
{
|
||||
#ifdef OPENCV_TRACE
|
||||
// TODO CV_TRACE_NS::details::setCurrentRegion(rootRegion);
|
||||
if (ctx.traceRootRegion && ctx.traceRootContext)
|
||||
CV_TRACE_NS::details::parallelForSetRootRegion(*ctx.traceRootRegion, *ctx.traceRootContext);
|
||||
CV__TRACE_OPENCV_FUNCTION_NAME("parallel_for_body");
|
||||
if (ctx.traceRootRegion)
|
||||
CV_TRACE_NS::details::parallelForAttachNestedRegion(*ctx.traceRootRegion);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_INSTRUMENTATION
|
||||
{
|
||||
cv::instr::InstrTLSStruct *pInstrTLS = &cv::instr::getInstrumentTLSStruct();
|
||||
pInstrTLS->pCurrentNode = ctx.pThreadRoot; // Initialize TLS node for thread
|
||||
}
|
||||
CV_INSTRUMENT_REGION()
|
||||
#endif
|
||||
|
||||
// propagate main thread state
|
||||
cv::theRNG() = ctx.rng;
|
||||
|
||||
cv::Range r;
|
||||
cv::Range wholeRange = ctx.wholeRange;
|
||||
int nstripes = ctx.nstripes;
|
||||
r.start = (int)(wholeRange.start +
|
||||
((uint64)sr.start*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
r.end = sr.end >= nstripes ? wholeRange.end : (int)(wholeRange.start +
|
||||
((uint64)sr.end*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
|
||||
#ifdef OPENCV_TRACE
|
||||
CV_TRACE_ARG_VALUE(range_start, "range.start", (int64)r.start);
|
||||
CV_TRACE_ARG_VALUE(range_end, "range.end", (int64)r.end);
|
||||
#endif
|
||||
|
||||
(*ctx.body)(r);
|
||||
|
||||
if (!ctx.is_rng_used && !(cv::theRNG() == ctx.rng))
|
||||
ctx.is_rng_used = true;
|
||||
}
|
||||
cv::Range stripeRange() const { return cv::Range(0, ctx.nstripes); }
|
||||
|
||||
protected:
|
||||
ParallelLoopBodyWrapperContext& ctx;
|
||||
};
|
||||
|
||||
#if defined HAVE_TBB
|
||||
class ProxyLoopBody : public ParallelLoopBodyWrapper
|
||||
{
|
||||
public:
|
||||
ProxyLoopBody(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes)
|
||||
: ParallelLoopBodyWrapper(_body, _r, _nstripes)
|
||||
ProxyLoopBody(ParallelLoopBodyWrapperContext& ctx_)
|
||||
: ParallelLoopBodyWrapper(ctx_)
|
||||
{}
|
||||
|
||||
void operator ()(const tbb::blocked_range<int>& range) const
|
||||
@ -261,8 +310,8 @@ namespace
|
||||
class ProxyLoopBody : public ParallelLoopBodyWrapper
|
||||
{
|
||||
public:
|
||||
ProxyLoopBody(const cv::ParallelLoopBody& _body, const cv::Range& _r, double _nstripes)
|
||||
: ParallelLoopBodyWrapper(_body, _r, _nstripes)
|
||||
ProxyLoopBody(ParallelLoopBodyWrapperContext& ctx)
|
||||
: ParallelLoopBodyWrapper(ctx)
|
||||
{}
|
||||
|
||||
void operator ()(int i) const
|
||||
@ -316,19 +365,30 @@ static SchedPtr pplScheduler;
|
||||
|
||||
void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes)
|
||||
{
|
||||
#ifdef OPENCV_TRACE
|
||||
CV__TRACE_OPENCV_FUNCTION_NAME_("parallel_for", 0);
|
||||
CV_TRACE_ARG_VALUE(range_start, "range.start", (int64)range.start);
|
||||
CV_TRACE_ARG_VALUE(range_end, "range.end", (int64)range.end);
|
||||
CV_TRACE_ARG_VALUE(nstripes, "nstripes", (int64)nstripes);
|
||||
#endif
|
||||
|
||||
CV_INSTRUMENT_REGION_MT_FORK()
|
||||
if (range.empty())
|
||||
return;
|
||||
|
||||
#ifdef CV_PARALLEL_FRAMEWORK
|
||||
|
||||
if(numThreads != 0)
|
||||
static int flagNestedParallelFor = 0;
|
||||
bool isNotNesterParallelFor = CV_XADD(&flagNestedParallelFor, 1) == 0;
|
||||
if(numThreads != 0 && isNotNesterParallelFor)
|
||||
{
|
||||
ProxyLoopBody pbody(body, range, nstripes);
|
||||
ParallelLoopBodyWrapperContext ctx(body, range, nstripes);
|
||||
ProxyLoopBody pbody(ctx);
|
||||
cv::Range stripeRange = pbody.stripeRange();
|
||||
if( stripeRange.end - stripeRange.start == 1 )
|
||||
{
|
||||
body(range);
|
||||
flagNestedParallelFor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -384,7 +444,7 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body,
|
||||
#error You have hacked and compiling with unsupported parallel framework
|
||||
|
||||
#endif
|
||||
|
||||
flagNestedParallelFor = 0;
|
||||
}
|
||||
else
|
||||
|
||||
|
@ -309,6 +309,8 @@ void ForThread::execute()
|
||||
|
||||
void ForThread::thread_body()
|
||||
{
|
||||
(void)cv::utils::getThreadID(); // notify OpenCV about new thread
|
||||
|
||||
m_parent->m_is_work_thread.get()->value = true;
|
||||
|
||||
pthread_mutex_lock(&m_thread_mutex);
|
||||
|
@ -6921,7 +6921,7 @@ FileNode FileStorage::root(int streamidx) const
|
||||
|
||||
FileStorage& operator << (FileStorage& fs, const String& str)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_REGION_VERBOSE();
|
||||
|
||||
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
|
||||
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
|
||||
|
@ -299,6 +299,12 @@ TLSData<CoreTLSData>& getCoreTlsData();
|
||||
#define CL_RUNTIME_EXPORT
|
||||
#endif
|
||||
|
||||
namespace utils {
|
||||
bool getConfigurationParameterBool(const char* name, bool defaultValue);
|
||||
size_t getConfigurationParameterSizeT(const char* name, size_t defaultValue);
|
||||
cv::String getConfigurationParameterString(const char* name, const char* defaultValue);
|
||||
}
|
||||
|
||||
extern bool __termination; // skip some cleanups, because process is terminating
|
||||
// (for example, if ExitProcess() was already called)
|
||||
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include "precomp.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#include <opencv2/core/utils/trace.private.hpp>
|
||||
|
||||
namespace cv {
|
||||
|
||||
static Mutex* __initialization_mutex = NULL;
|
||||
@ -1490,6 +1492,7 @@ void TLSDataContainer::cleanup()
|
||||
|
||||
void* TLSDataContainer::getData() const
|
||||
{
|
||||
CV_Assert(key_ != -1 && "Can't fetch data from terminated TLS container.");
|
||||
void* pData = getTlsStorage().getData(key_); // Check if data was already allocated
|
||||
if(!pData)
|
||||
{
|
||||
@ -1534,6 +1537,99 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace {
|
||||
static int g_threadNum = 0;
|
||||
class ThreadID {
|
||||
public:
|
||||
const int id;
|
||||
ThreadID() :
|
||||
id(CV_XADD(&g_threadNum, 1))
|
||||
{
|
||||
#ifdef OPENCV_WITH_ITT
|
||||
__itt_thread_set_name(cv::format("OpenCVThread-%03d", id).c_str());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
static TLSData<ThreadID>& getThreadIDTLS()
|
||||
{
|
||||
CV_SINGLETON_LAZY_INIT_REF(TLSData<ThreadID>, new TLSData<ThreadID>());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
int utils::getThreadID() { return getThreadIDTLS().get()->id; }
|
||||
|
||||
bool utils::getConfigurationParameterBool(const char* name, bool defaultValue)
|
||||
{
|
||||
#ifdef NO_GETENV
|
||||
const char* envValue = NULL;
|
||||
#else
|
||||
const char* envValue = getenv(name);
|
||||
#endif
|
||||
if (envValue == NULL)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
cv::String value = envValue;
|
||||
if (value == "1" || value == "True" || value == "true" || value == "TRUE")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (value == "0" || value == "False" || value == "false" || value == "FALSE")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
|
||||
}
|
||||
|
||||
|
||||
size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultValue)
|
||||
{
|
||||
#ifdef NO_GETENV
|
||||
const char* envValue = NULL;
|
||||
#else
|
||||
const char* envValue = getenv(name);
|
||||
#endif
|
||||
if (envValue == NULL)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
cv::String value = envValue;
|
||||
size_t pos = 0;
|
||||
for (; pos < value.size(); pos++)
|
||||
{
|
||||
if (!isdigit(value[pos]))
|
||||
break;
|
||||
}
|
||||
cv::String valueStr = value.substr(0, pos);
|
||||
cv::String suffixStr = value.substr(pos, value.length() - pos);
|
||||
int v = atoi(valueStr.c_str());
|
||||
if (suffixStr.length() == 0)
|
||||
return v;
|
||||
else if (suffixStr == "MB" || suffixStr == "Mb" || suffixStr == "mb")
|
||||
return v * 1024 * 1024;
|
||||
else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb")
|
||||
return v * 1024;
|
||||
CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str()));
|
||||
}
|
||||
|
||||
cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue)
|
||||
{
|
||||
#ifdef NO_GETENV
|
||||
const char* envValue = NULL;
|
||||
#else
|
||||
const char* envValue = getenv(name);
|
||||
#endif
|
||||
if (envValue == NULL)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
cv::String value = envValue;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CV_COLLECT_IMPL_DATA
|
||||
ImplCollector& getImplData()
|
||||
{
|
||||
|
1115
modules/core/src/trace.cpp
Normal file
1115
modules/core/src/trace.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -168,46 +168,55 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
|
||||
|
||||
void cv::namedWindow( const String& winname, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvNamedWindow( winname.c_str(), flags );
|
||||
}
|
||||
|
||||
void cv::destroyWindow( const String& winname )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvDestroyWindow( winname.c_str() );
|
||||
}
|
||||
|
||||
void cv::destroyAllWindows()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvDestroyAllWindows();
|
||||
}
|
||||
|
||||
void cv::resizeWindow( const String& winname, int width, int height )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvResizeWindow( winname.c_str(), width, height );
|
||||
}
|
||||
|
||||
void cv::moveWindow( const String& winname, int x, int y )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvMoveWindow( winname.c_str(), x, y );
|
||||
}
|
||||
|
||||
void cv::setWindowProperty(const String& winname, int prop_id, double prop_value)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetWindowProperty( winname.c_str(), prop_id, prop_value);
|
||||
}
|
||||
|
||||
double cv::getWindowProperty(const String& winname, int prop_id)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return cvGetWindowProperty(winname.c_str(), prop_id);
|
||||
}
|
||||
|
||||
int cv::waitKeyEx(int delay)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return cvWaitKey(delay);
|
||||
}
|
||||
|
||||
int cv::waitKey(int delay)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int code = waitKeyEx(delay);
|
||||
#ifndef HAVE_WINRT
|
||||
static int use_legacy = -1;
|
||||
@ -225,42 +234,50 @@ int cv::createTrackbar(const String& trackbarName, const String& winName,
|
||||
int* value, int count, TrackbarCallback callback,
|
||||
void* userdata)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return cvCreateTrackbar2(trackbarName.c_str(), winName.c_str(),
|
||||
value, count, callback, userdata);
|
||||
}
|
||||
|
||||
void cv::setTrackbarPos( const String& trackbarName, const String& winName, int value )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetTrackbarPos(trackbarName.c_str(), winName.c_str(), value );
|
||||
}
|
||||
|
||||
void cv::setTrackbarMax(const String& trackbarName, const String& winName, int maxval)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetTrackbarMax(trackbarName.c_str(), winName.c_str(), maxval);
|
||||
}
|
||||
|
||||
void cv::setTrackbarMin(const String& trackbarName, const String& winName, int minval)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetTrackbarMin(trackbarName.c_str(), winName.c_str(), minval);
|
||||
}
|
||||
|
||||
int cv::getTrackbarPos( const String& trackbarName, const String& winName )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return cvGetTrackbarPos(trackbarName.c_str(), winName.c_str());
|
||||
}
|
||||
|
||||
void cv::setMouseCallback( const String& windowName, MouseCallback onMouse, void* param)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetMouseCallback(windowName.c_str(), onMouse, param);
|
||||
}
|
||||
|
||||
int cv::getMouseWheelDelta( int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return CV_GET_WHEEL_DELTA(flags);
|
||||
}
|
||||
|
||||
int cv::startWindowThread()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return cvStartWindowThread();
|
||||
}
|
||||
|
||||
@ -268,16 +285,19 @@ int cv::startWindowThread()
|
||||
|
||||
void cv::setOpenGlDrawCallback(const String& name, OpenGlDrawCallback callback, void* userdata)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetOpenGlDrawCallback(name.c_str(), callback, userdata);
|
||||
}
|
||||
|
||||
void cv::setOpenGlContext(const String& windowName)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvSetOpenGlContext(windowName.c_str());
|
||||
}
|
||||
|
||||
void cv::updateWindow(const String& windowName)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
cvUpdateWindow(windowName.c_str());
|
||||
}
|
||||
|
||||
@ -299,6 +319,7 @@ namespace
|
||||
|
||||
void cv::imshow( const String& winname, InputArray _img )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const Size size = _img.size();
|
||||
#ifndef HAVE_OPENGL
|
||||
CV_Assert(size.width>0 && size.height>0);
|
||||
@ -355,6 +376,7 @@ void cv::imshow( const String& winname, InputArray _img )
|
||||
|
||||
void cv::imshow(const String& winname, const ogl::Texture2D& _tex)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
#ifndef HAVE_OPENGL
|
||||
(void) winname;
|
||||
(void) _tex;
|
||||
|
@ -556,6 +556,8 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
|
||||
*/
|
||||
Mat imread( const String& filename, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
/// create the basic container
|
||||
Mat img;
|
||||
|
||||
@ -584,6 +586,8 @@ Mat imread( const String& filename, int flags )
|
||||
*/
|
||||
bool imreadmulti(const String& filename, std::vector<Mat>& mats, int flags)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
return imreadmulti_(filename, flags, mats);
|
||||
}
|
||||
|
||||
@ -621,6 +625,8 @@ static bool imwrite_( const String& filename, const Mat& image,
|
||||
bool imwrite( const String& filename, InputArray _img,
|
||||
const std::vector<int>& params )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
Mat img = _img.getMat();
|
||||
return imwrite_(filename, img, params, false);
|
||||
}
|
||||
@ -725,6 +731,8 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
|
||||
|
||||
Mat imdecode( InputArray _buf, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
Mat buf = _buf.getMat(), img;
|
||||
imdecode_( buf, flags, LOAD_MAT, &img );
|
||||
|
||||
@ -739,6 +747,8 @@ Mat imdecode( InputArray _buf, int flags )
|
||||
|
||||
Mat imdecode( InputArray _buf, int flags, Mat* dst )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
Mat buf = _buf.getMat(), img;
|
||||
dst = dst ? dst : &img;
|
||||
imdecode_( buf, flags, LOAD_MAT, dst );
|
||||
@ -755,6 +765,8 @@ Mat imdecode( InputArray _buf, int flags, Mat* dst )
|
||||
bool imencode( const String& ext, InputArray _image,
|
||||
std::vector<uchar>& buf, const std::vector<int>& params )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
Mat image = _image.getMat();
|
||||
|
||||
int channels = image.channels();
|
||||
|
@ -47,8 +47,6 @@
|
||||
#include "../perf_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_perf.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace ocl {
|
||||
|
||||
@ -318,11 +316,11 @@ OCL_PERF_TEST_P(CannyFixture, Canny, ::testing::Combine(OCL_TEST_SIZES, OCL_PERF
|
||||
|
||||
declare.in(img).out(edges);
|
||||
|
||||
OCL_TEST_CYCLE() cv::Canny(img, edges, 50.0, 100.0, apertureSize, L2Grad);
|
||||
PERF_SAMPLE_BEGIN();
|
||||
cv::Canny(img, edges, 50.0, 100.0, apertureSize, L2Grad);
|
||||
PERF_SAMPLE_END();
|
||||
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
||||
|
@ -31,7 +31,9 @@ PERF_TEST_P(Img_Aperture_L2_thresholds, canny,
|
||||
|
||||
declare.in(img).out(edges);
|
||||
|
||||
TEST_CYCLE() Canny(img, edges, thresh_low, thresh_high, aperture, useL2);
|
||||
PERF_SAMPLE_BEGIN();
|
||||
Canny(img, edges, thresh_low, thresh_high, aperture, useL2);
|
||||
PERF_SAMPLE_END();
|
||||
|
||||
SANITY_CHECK(edges);
|
||||
}
|
||||
|
@ -350,6 +350,8 @@ public:
|
||||
|
||||
void operator()(const Range &boundaries) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
Mat dx, dy;
|
||||
AutoBuffer<short> dxMax(0), dyMax(0);
|
||||
std::deque<uchar*> stack, borderPeaksLocal;
|
||||
@ -358,6 +360,7 @@ public:
|
||||
short *_dx, *_dy, *_dx_a = NULL, *_dy_a = NULL, *_dx_n = NULL, *_dy_n = NULL;
|
||||
uchar *_pmap;
|
||||
|
||||
CV_TRACE_REGION("gradient")
|
||||
if(needGradient)
|
||||
{
|
||||
Sobel(src.rowRange(rowStart, rowEnd), dx, CV_16S, 1, 0, aperture_size, 1, 0, BORDER_REPLICATE);
|
||||
@ -369,6 +372,7 @@ public:
|
||||
dy = src2.rowRange(rowStart, rowEnd);
|
||||
}
|
||||
|
||||
CV_TRACE_REGION_NEXT("magnitude");
|
||||
if(cn > 1)
|
||||
{
|
||||
dxMax.allocate(2 * dx.cols);
|
||||
@ -740,6 +744,7 @@ public:
|
||||
uint pmapDiff = (uint)(((rowEnd == src.rows) ? map.datalimit : (map.data + boundaries.end * mapstep)) - pmapLower);
|
||||
|
||||
// now track the edges (hysteresis thresholding)
|
||||
CV_TRACE_REGION_NEXT("hysteresis");
|
||||
while (!stack.empty())
|
||||
{
|
||||
uchar *m = stack.back();
|
||||
@ -1035,6 +1040,7 @@ void Canny( InputArray _src, OutputArray _dst,
|
||||
|
||||
parallel_for_(Range(0, src.rows), parallelCanny(src, map, stack, low, high, aperture_size, L2gradient), numOfThreads);
|
||||
|
||||
CV_TRACE_REGION("global_hysteresis");
|
||||
// now track the edges (hysteresis thresholding)
|
||||
ptrdiff_t mapstep = map.cols;
|
||||
|
||||
@ -1053,6 +1059,7 @@ void Canny( InputArray _src, OutputArray _dst,
|
||||
if (!m[mapstep+1]) CANNY_PUSH((m+mapstep+1), stack);
|
||||
}
|
||||
|
||||
CV_TRACE_REGION_NEXT("finalPass");
|
||||
parallel_for_(Range(0, src.rows), finalPass(map, dst), src.total()/(double)(1<<16));
|
||||
}
|
||||
|
||||
@ -1105,6 +1112,7 @@ void Canny( InputArray _dx, InputArray _dy, OutputArray _dst,
|
||||
|
||||
parallel_for_(Range(0, dx.rows), parallelCanny(dx, dy, map, stack, low, high, L2gradient), numOfThreads);
|
||||
|
||||
CV_TRACE_REGION("global_hysteresis")
|
||||
// now track the edges (hysteresis thresholding)
|
||||
ptrdiff_t mapstep = map.cols;
|
||||
|
||||
@ -1123,6 +1131,7 @@ void Canny( InputArray _dx, InputArray _dy, OutputArray _dst,
|
||||
if (!m[mapstep+1]) CANNY_PUSH((m+mapstep+1), stack);
|
||||
}
|
||||
|
||||
CV_TRACE_REGION_NEXT("finalPass");
|
||||
parallel_for_(Range(0, dx.rows), finalPass(map, dst), dx.total()/(double)(1<<16));
|
||||
}
|
||||
|
||||
|
@ -271,6 +271,8 @@ public:
|
||||
|
||||
virtual void operator()(const Range& range) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
const uchar* yS = src_data + static_cast<size_t>(range.start) * src_step;
|
||||
uchar* yD = dst_data + static_cast<size_t>(range.start) * dst_step;
|
||||
|
||||
|
@ -1028,6 +1028,7 @@ Ptr<TrainData> TrainData::loadFromCSV(const String& filename,
|
||||
const String& varTypeSpec,
|
||||
char delimiter, char missch)
|
||||
{
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED();
|
||||
Ptr<TrainDataImpl> td = makePtr<TrainDataImpl>();
|
||||
if(!td->loadCSV(filename, headerLines, responseStartIdx, responseEndIdx, varTypeSpec, delimiter, missch))
|
||||
td.release();
|
||||
@ -1038,6 +1039,7 @@ Ptr<TrainData> TrainData::create(InputArray samples, int layout, InputArray resp
|
||||
InputArray varIdx, InputArray sampleIdx, InputArray sampleWeights,
|
||||
InputArray varType)
|
||||
{
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED();
|
||||
Ptr<TrainDataImpl> td = makePtr<TrainDataImpl>();
|
||||
td->setData(samples, layout, responses, varIdx, sampleIdx, sampleWeights, varType, noArray());
|
||||
return td;
|
||||
|
@ -45,6 +45,7 @@ namespace cv { namespace ml {
|
||||
ParamGrid::ParamGrid() { minVal = maxVal = 0.; logStep = 1; }
|
||||
ParamGrid::ParamGrid(double _minVal, double _maxVal, double _logStep)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
minVal = std::min(_minVal, _maxVal);
|
||||
maxVal = std::max(_minVal, _maxVal);
|
||||
logStep = std::max(_logStep, 1.);
|
||||
@ -60,17 +61,20 @@ int StatModel::getVarCount() const { return 0; }
|
||||
|
||||
bool StatModel::train( const Ptr<TrainData>&, int )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
CV_Error(CV_StsNotImplemented, "");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StatModel::train( InputArray samples, int layout, InputArray responses )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return train(TrainData::create(samples, layout, responses));
|
||||
}
|
||||
|
||||
float StatModel::calcError( const Ptr<TrainData>& data, bool testerr, OutputArray _resp ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED();
|
||||
Mat samples = data->getSamples();
|
||||
int layout = data->getLayout();
|
||||
Mat sidx = testerr ? data->getTestSampleIdx() : data->getTrainSampleIdx();
|
||||
@ -119,6 +123,7 @@ float StatModel::calcError( const Ptr<TrainData>& data, bool testerr, OutputArra
|
||||
/* Calculates upper triangular matrix S, where A is a symmetrical matrix A=S'*S */
|
||||
static void Cholesky( const Mat& A, Mat& S )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
CV_Assert(A.type() == CV_32F);
|
||||
|
||||
S = A.clone();
|
||||
@ -133,6 +138,7 @@ static void Cholesky( const Mat& A, Mat& S )
|
||||
average row vector, <cov> - symmetric covariation matrix */
|
||||
void randMVNormal( InputArray _mean, InputArray _cov, int nsamples, OutputArray _samples )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
// check mean vector and covariance matrix
|
||||
Mat mean = _mean.getMat(), cov = _cov.getMat();
|
||||
int dim = (int)mean.total(); // dimensionality
|
||||
|
@ -135,6 +135,7 @@ Ptr<LogisticRegression> LogisticRegression::load(const String& filepath, const S
|
||||
|
||||
bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
|
||||
{
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED();
|
||||
// return value
|
||||
bool ok = false;
|
||||
|
||||
@ -313,6 +314,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
|
||||
|
||||
Mat LogisticRegressionImpl::calc_sigmoid(const Mat& data) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
Mat dest;
|
||||
exp(-data, dest);
|
||||
return 1.0/(1.0+dest);
|
||||
@ -320,6 +322,7 @@ Mat LogisticRegressionImpl::calc_sigmoid(const Mat& data) const
|
||||
|
||||
double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels, const Mat& _init_theta)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
float llambda = 0; /*changed llambda from int to float to solve issue #7924*/
|
||||
int m;
|
||||
int n;
|
||||
@ -410,6 +413,7 @@ struct LogisticRegressionImpl_ComputeDradient_Impl : ParallelLoopBody
|
||||
|
||||
void LogisticRegressionImpl::compute_gradient(const Mat& _data, const Mat& _labels, const Mat &_theta, const double _lambda, Mat & _gradient )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const int m = _data.rows;
|
||||
Mat pcal_a, pcal_b, pcal_ab;
|
||||
|
||||
@ -431,6 +435,7 @@ void LogisticRegressionImpl::compute_gradient(const Mat& _data, const Mat& _labe
|
||||
|
||||
Mat LogisticRegressionImpl::batch_gradient_descent(const Mat& _data, const Mat& _labels, const Mat& _init_theta)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
// implements batch gradient descent
|
||||
if(this->params.alpha<=0)
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ namespace ml {
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
RTreeParams::RTreeParams()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
calcVarImportance = false;
|
||||
nactiveVars = 0;
|
||||
termCrit = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 50, 0.1);
|
||||
@ -58,6 +59,7 @@ RTreeParams::RTreeParams(bool _calcVarImportance,
|
||||
int _nactiveVars,
|
||||
TermCriteria _termCrit )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
calcVarImportance = _calcVarImportance;
|
||||
nactiveVars = _nactiveVars;
|
||||
termCrit = _termCrit;
|
||||
@ -69,6 +71,7 @@ class DTreesImplForRTrees : public DTreesImpl
|
||||
public:
|
||||
DTreesImplForRTrees()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
params.setMaxDepth(5);
|
||||
params.setMinSampleCount(10);
|
||||
params.setRegressionAccuracy(0.f);
|
||||
@ -83,6 +86,7 @@ public:
|
||||
|
||||
void clear()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
DTreesImpl::clear();
|
||||
oobError = 0.;
|
||||
rng = RNG((uint64)-1);
|
||||
@ -90,6 +94,7 @@ public:
|
||||
|
||||
const vector<int>& getActiveVars()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int i, nvars = (int)allVars.size(), m = (int)activeVars.size();
|
||||
for( i = 0; i < nvars; i++ )
|
||||
{
|
||||
@ -104,6 +109,7 @@ public:
|
||||
|
||||
void startTraining( const Ptr<TrainData>& trainData, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
DTreesImpl::startTraining(trainData, flags);
|
||||
int nvars = w->data->getNVars();
|
||||
int i, m = rparams.nactiveVars > 0 ? rparams.nactiveVars : cvRound(std::sqrt((double)nvars));
|
||||
@ -116,6 +122,7 @@ public:
|
||||
|
||||
void endTraining()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
DTreesImpl::endTraining();
|
||||
vector<int> a, b;
|
||||
std::swap(allVars, a);
|
||||
@ -124,6 +131,7 @@ public:
|
||||
|
||||
bool train( const Ptr<TrainData>& trainData, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
startTraining(trainData, flags);
|
||||
int treeidx, ntrees = (rparams.termCrit.type & TermCriteria::COUNT) != 0 ?
|
||||
rparams.termCrit.maxCount : 10000;
|
||||
@ -286,12 +294,14 @@ public:
|
||||
|
||||
void writeTrainingParams( FileStorage& fs ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
DTreesImpl::writeTrainingParams(fs);
|
||||
fs << "nactive_vars" << rparams.nactiveVars;
|
||||
}
|
||||
|
||||
void write( FileStorage& fs ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
if( roots.empty() )
|
||||
CV_Error( CV_StsBadArg, "RTrees have not been trained" );
|
||||
|
||||
@ -319,6 +329,7 @@ public:
|
||||
|
||||
void readParams( const FileNode& fn )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
DTreesImpl::readParams(fn);
|
||||
|
||||
FileNode tparams_node = fn["training_params"];
|
||||
@ -327,6 +338,7 @@ public:
|
||||
|
||||
void read( const FileNode& fn )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
clear();
|
||||
|
||||
//int nclasses = (int)fn["nclasses"];
|
||||
@ -351,6 +363,7 @@ public:
|
||||
|
||||
void getVotes( InputArray input, OutputArray output, int flags ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
CV_Assert( !roots.empty() );
|
||||
int nclasses = (int)classLabels.size(), ntrees = (int)roots.size();
|
||||
Mat samples = input.getMat(), results;
|
||||
@ -435,6 +448,7 @@ public:
|
||||
|
||||
bool train( const Ptr<TrainData>& trainData, int flags )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
if (impl.getCVFolds() != 0)
|
||||
CV_Error(Error::StsBadArg, "Cross validation for RTrees is not implemented");
|
||||
return impl.train(trainData, flags);
|
||||
@ -442,22 +456,26 @@ public:
|
||||
|
||||
float predict( InputArray samples, OutputArray results, int flags ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return impl.predict(samples, results, flags);
|
||||
}
|
||||
|
||||
void write( FileStorage& fs ) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
impl.write(fs);
|
||||
}
|
||||
|
||||
void read( const FileNode& fn )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
impl.read(fn);
|
||||
}
|
||||
|
||||
void getVotes_( InputArray samples, OutputArray results, int flags ) const
|
||||
{
|
||||
impl.getVotes(samples, results, flags);
|
||||
CV_TRACE_FUNCTION();
|
||||
impl.getVotes(samples, results, flags);
|
||||
}
|
||||
|
||||
Mat getVarImportance() const { return Mat_<float>(impl.varImportance, true); }
|
||||
@ -477,17 +495,20 @@ public:
|
||||
|
||||
Ptr<RTrees> RTrees::create()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return makePtr<RTreesImpl>();
|
||||
}
|
||||
|
||||
//Function needed for Python and Java wrappers
|
||||
Ptr<RTrees> RTrees::load(const String& filepath, const String& nodeName)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
return Algorithm::load<RTrees>(filepath, nodeName);
|
||||
}
|
||||
|
||||
void RTrees::getVotes(InputArray input, OutputArray output, int flags) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const RTreesImpl* this_ = dynamic_cast<const RTreesImpl*>(this);
|
||||
if(!this_)
|
||||
CV_Error(Error::StsNotImplemented, "the class is not RTreesImpl");
|
||||
|
@ -50,6 +50,7 @@ using cv::ml::KNearest;
|
||||
static
|
||||
void defaultDistribs( Mat& means, vector<Mat>& covs, int type=CV_32FC1 )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
float mp0[] = {0.0f, 0.0f}, cp0[] = {0.67f, 0.0f, 0.0f, 0.67f};
|
||||
float mp1[] = {5.0f, 0.0f}, cp1[] = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
float mp2[] = {1.0f, 5.0f}, cp2[] = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
@ -76,6 +77,7 @@ void defaultDistribs( Mat& means, vector<Mat>& covs, int type=CV_32FC1 )
|
||||
static
|
||||
void generateData( Mat& data, Mat& labels, const vector<int>& sizes, const Mat& _means, const vector<Mat>& covs, int dataType, int labelType )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
vector<int>::const_iterator sit = sizes.begin();
|
||||
int total = 0;
|
||||
for( ; sit != sizes.end(); ++sit )
|
||||
@ -226,6 +228,7 @@ protected:
|
||||
|
||||
void CV_KMeansTest::run( int /*start_from*/ )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const int iters = 100;
|
||||
int sizesArr[] = { 5000, 7000, 8000 };
|
||||
int pointsCount = sizesArr[0]+ sizesArr[1] + sizesArr[2];
|
||||
|
@ -64,6 +64,7 @@ using namespace cv::ml;
|
||||
|
||||
static bool calculateError( const Mat& _p_labels, const Mat& _o_labels, float& error)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
error = 0.0f;
|
||||
float accuracy = 0.0f;
|
||||
Mat _p_labels_temp;
|
||||
@ -91,6 +92,7 @@ protected:
|
||||
|
||||
void CV_LRTest::run( int /*start_from*/ )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
// initialize varibles from the popular Iris Dataset
|
||||
string dataFileName = ts->get_data_path() + "iris.data";
|
||||
Ptr<TrainData> tdata = TrainData::loadFromCSV(dataFileName, 0);
|
||||
@ -150,6 +152,7 @@ protected:
|
||||
|
||||
void CV_LRTest_SaveLoad::run( int /*start_from*/ )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int code = cvtest::TS::OK;
|
||||
|
||||
// initialize varibles from the popular Iris Dataset
|
||||
|
@ -51,6 +51,7 @@ CV_AMLTest::CV_AMLTest( const char* _modelName ) : CV_MLBaseTest( _modelName )
|
||||
|
||||
int CV_AMLTest::run_test_case( int testCaseIdx )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int code = cvtest::TS::OK;
|
||||
code = prepare_test_case( testCaseIdx );
|
||||
|
||||
@ -91,6 +92,7 @@ int CV_AMLTest::run_test_case( int testCaseIdx )
|
||||
|
||||
int CV_AMLTest::validate_test_results( int testCaseIdx )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int iters;
|
||||
float mean, sigma;
|
||||
// read validation params
|
||||
|
@ -87,6 +87,7 @@ int str_to_ann_train_method( String& str )
|
||||
|
||||
void ann_check_data( Ptr<TrainData> _data )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
Mat values = _data->getSamples();
|
||||
Mat var_idx = _data->getVarIdx();
|
||||
int nvars = (int)var_idx.total();
|
||||
@ -99,6 +100,7 @@ void ann_check_data( Ptr<TrainData> _data )
|
||||
// unroll the categorical responses to binary vectors
|
||||
Mat ann_get_new_responses( Ptr<TrainData> _data, map<int, int>& cls_map )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
Mat train_sidx = _data->getTrainSampleIdx();
|
||||
int* train_sidx_ptr = train_sidx.ptr<int>();
|
||||
Mat responses = _data->getResponses();
|
||||
@ -130,6 +132,7 @@ Mat ann_get_new_responses( Ptr<TrainData> _data, map<int, int>& cls_map )
|
||||
|
||||
float ann_calc_error( Ptr<StatModel> ann, Ptr<TrainData> _data, map<int, int>& cls_map, int type, vector<float> *resp_labels )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
float err = 0;
|
||||
Mat samples = _data->getSamples();
|
||||
Mat responses = _data->getResponses();
|
||||
@ -241,6 +244,7 @@ CV_MLBaseTest::~CV_MLBaseTest()
|
||||
|
||||
int CV_MLBaseTest::read_params( CvFileStorage* __fs )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
FileStorage _fs(__fs, false);
|
||||
if( !_fs.isOpened() )
|
||||
test_case_count = -1;
|
||||
@ -265,6 +269,7 @@ int CV_MLBaseTest::read_params( CvFileStorage* __fs )
|
||||
|
||||
void CV_MLBaseTest::run( int )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
string filename = ts->get_data_path();
|
||||
filename += get_validation_filename();
|
||||
validationFS.open( filename, FileStorage::READ );
|
||||
@ -273,6 +278,7 @@ void CV_MLBaseTest::run( int )
|
||||
int code = cvtest::TS::OK;
|
||||
for (int i = 0; i < test_case_count; i++)
|
||||
{
|
||||
CV_TRACE_REGION("iteration");
|
||||
int temp_code = run_test_case( i );
|
||||
if (temp_code == cvtest::TS::OK)
|
||||
temp_code = validate_test_results( i );
|
||||
@ -289,6 +295,7 @@ void CV_MLBaseTest::run( int )
|
||||
|
||||
int CV_MLBaseTest::prepare_test_case( int test_case_idx )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
clear();
|
||||
|
||||
string dataPath = ts->get_data_path();
|
||||
@ -331,6 +338,7 @@ string& CV_MLBaseTest::get_validation_filename()
|
||||
|
||||
int CV_MLBaseTest::train( int testCaseIdx )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
bool is_trained = false;
|
||||
FileNode modelParamsNode =
|
||||
validationFS.getFirstTopLevelNode()["validation"][modelName][dataSetNames[testCaseIdx]]["model_params"];
|
||||
@ -489,6 +497,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
|
||||
|
||||
float CV_MLBaseTest::get_test_error( int /*testCaseIdx*/, vector<float> *resp )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
int type = CV_TEST_ERROR;
|
||||
float err = 0;
|
||||
Mat _resp;
|
||||
@ -506,11 +515,13 @@ float CV_MLBaseTest::get_test_error( int /*testCaseIdx*/, vector<float> *resp )
|
||||
|
||||
void CV_MLBaseTest::save( const char* filename )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
model->save( filename );
|
||||
}
|
||||
|
||||
void CV_MLBaseTest::load( const char* filename )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
if( modelName == CV_NBAYES )
|
||||
model = Algorithm::load<NormalBayesClassifier>( filename );
|
||||
else if( modelName == CV_KNEAREST )
|
||||
|
@ -37,6 +37,7 @@ ocv_list_filterout(opencv_hdrs "modules/core/.*/cuda")
|
||||
ocv_list_filterout(opencv_hdrs "modules/cuda.*")
|
||||
ocv_list_filterout(opencv_hdrs "modules/cudev")
|
||||
ocv_list_filterout(opencv_hdrs "modules/core/.*/hal/")
|
||||
ocv_list_filterout(opencv_hdrs "modules/.+/utils/.*")
|
||||
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker.hpp") # Conditional compilation
|
||||
|
||||
set(cv2_generated_hdrs
|
||||
|
@ -1,7 +1,22 @@
|
||||
#ifndef OPENCV_TS_HPP
|
||||
#define OPENCV_TS_HPP
|
||||
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#ifndef __OPENCV_TESTS
|
||||
#define __OPENCV_TESTS 1
|
||||
#endif
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/videoio.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
#include "opencv2/core/utils/trace.hpp"
|
||||
|
||||
#include <stdarg.h> // for va_list
|
||||
|
||||
#include "cvconfig.h"
|
||||
@ -46,9 +61,6 @@
|
||||
#define PARAM_TEST_CASE(name, ...) struct name : testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > >
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
namespace cvtest
|
||||
{
|
||||
|
||||
@ -615,6 +627,8 @@ void parseCustomOptions(int argc, char **argv);
|
||||
#define CV_TEST_MAIN_EX(resourcesubdir, INIT0, ...) \
|
||||
int main(int argc, char **argv) \
|
||||
{ \
|
||||
CV_TRACE_FUNCTION(); \
|
||||
{ CV_TRACE_REGION("INIT"); \
|
||||
using namespace cvtest; \
|
||||
TS* ts = TS::ptr(); \
|
||||
ts->init(resourcesubdir); \
|
||||
@ -624,6 +638,7 @@ int main(int argc, char **argv) \
|
||||
TEST_DUMP_OCL_INFO \
|
||||
__CV_TEST_EXEC_ARGS(__VA_ARGS__) \
|
||||
parseCustomOptions(argc, argv); \
|
||||
} \
|
||||
return RUN_ALL_TESTS(); \
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,9 @@
|
||||
#ifndef OPENCV_CUDA_PERF_UTILITY_HPP
|
||||
#define OPENCV_CUDA_PERF_UTILITY_HPP
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/videoio.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#include "opencv2/ts/ts_perf.hpp"
|
||||
#include "cvconfig.h"
|
||||
|
||||
namespace perf
|
||||
{
|
||||
|
@ -43,15 +43,11 @@
|
||||
#ifndef OPENCV_CUDA_TEST_UTILITY_HPP
|
||||
#define OPENCV_CUDA_TEST_UTILITY_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/core/cuda.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include "opencv2/core/cuda.hpp"
|
||||
|
||||
namespace cvtest
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -42,6 +42,8 @@
|
||||
#ifndef OPENCV_TS_OCL_PERF_HPP
|
||||
#define OPENCV_TS_OCL_PERF_HPP
|
||||
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#include "ocl_test.hpp"
|
||||
#include "ts_perf.hpp"
|
||||
|
||||
@ -67,7 +69,7 @@ using std::tr1::tuple;
|
||||
protected: \
|
||||
virtual void PerfTestBody(); \
|
||||
}; \
|
||||
TEST_F(OCL##_##fixture##_##name, name) { declare.strategy(OCL_PERF_STRATEGY); RunPerfTestBody(); } \
|
||||
TEST_F(OCL##_##fixture##_##name, name) { CV_TRACE_REGION("PERF_TEST: " #fixture "_" #name); declare.strategy(OCL_PERF_STRATEGY); RunPerfTestBody(); } \
|
||||
void OCL##_##fixture##_##name::PerfTestBody()
|
||||
|
||||
#define SIMPLE_PERF_TEST_P(fixture, name, params) \
|
||||
@ -79,7 +81,7 @@ using std::tr1::tuple;
|
||||
protected: \
|
||||
virtual void PerfTestBody(); \
|
||||
}; \
|
||||
TEST_P(OCL##_##fixture##_##name, name) { declare.strategy(OCL_PERF_STRATEGY); RunPerfTestBody(); } \
|
||||
TEST_P(OCL##_##fixture##_##name, name) { CV_TRACE_REGION("PERF_TEST_P: " #fixture "_" #name); declare.strategy(OCL_PERF_STRATEGY); RunPerfTestBody(); } \
|
||||
INSTANTIATE_TEST_CASE_P(/*none*/, OCL##_##fixture##_##name, params); \
|
||||
void OCL##_##fixture##_##name::PerfTestBody()
|
||||
|
||||
@ -95,17 +97,27 @@ using std::tr1::tuple;
|
||||
|
||||
#define OCL_PERF_ENUM ::testing::Values
|
||||
|
||||
// TODO Replace finish call to dstUMat.wait()
|
||||
//! deprecated
|
||||
#define OCL_TEST_CYCLE() \
|
||||
for (cvtest::ocl::perf::safeFinish(); next() && startTimer(); cvtest::ocl::perf::safeFinish(), stopTimer())
|
||||
|
||||
//! deprecated
|
||||
#define OCL_TEST_CYCLE_N(n) \
|
||||
for (declare.iterations(n), cvtest::ocl::perf::safeFinish(); next() && startTimer(); cvtest::ocl::perf::safeFinish(), stopTimer())
|
||||
|
||||
//! deprecated
|
||||
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) \
|
||||
for (declare.runs(runsNum), cvtest::ocl::perf::safeFinish(); next() && startTimer(); cvtest::ocl::perf::safeFinish(), stopTimer()) \
|
||||
for (int r = 0; r < runsNum; cvtest::ocl::perf::safeFinish(), ++r)
|
||||
|
||||
#undef PERF_SAMPLE_BEGIN
|
||||
#undef PERF_SAMPLE_END
|
||||
#define PERF_SAMPLE_BEGIN() \
|
||||
cvtest::ocl::perf::safeFinish(); \
|
||||
for(; next() && startTimer(); cvtest::ocl::perf::safeFinish(), stopTimer()) \
|
||||
{ \
|
||||
CV_TRACE_REGION("iteration");
|
||||
#define PERF_SAMPLE_END() \
|
||||
}
|
||||
|
||||
|
||||
namespace perf {
|
||||
|
||||
|
@ -42,8 +42,6 @@
|
||||
#ifndef OPENCV_TS_OCL_TEST_HPP
|
||||
#define OPENCV_TS_OCL_TEST_HPP
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
|
@ -16,8 +16,9 @@ void checkIppStatus();
|
||||
cv::ipp::setIppStatus(0); \
|
||||
cv::theRNG().state = cvtest::param_seed;
|
||||
#define CV_TEST_CLEANUP ::cvtest::checkIppStatus();
|
||||
#define CV_TEST_BODY_IMPL \
|
||||
#define CV_TEST_BODY_IMPL(name) \
|
||||
{ \
|
||||
CV__TRACE_APP_FUNCTION_NAME(name); \
|
||||
try { \
|
||||
CV_TEST_INIT \
|
||||
Body(); \
|
||||
@ -53,7 +54,7 @@ void checkIppStatus();
|
||||
::testing::Test::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() CV_TEST_BODY_IMPL \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() CV_TEST_BODY_IMPL( #test_case_name "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::Body()
|
||||
|
||||
#undef TEST_F
|
||||
@ -79,7 +80,7 @@ void checkIppStatus();
|
||||
test_fixture::TearDownTestCase, \
|
||||
new ::testing::internal::TestFactoryImpl<\
|
||||
GTEST_TEST_CLASS_NAME_(test_fixture, test_name)>);\
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() CV_TEST_BODY_IMPL \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() CV_TEST_BODY_IMPL( #test_fixture "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::Body()
|
||||
|
||||
#undef TEST_P
|
||||
@ -111,7 +112,7 @@ void checkIppStatus();
|
||||
int GTEST_TEST_CLASS_NAME_(test_case_name, \
|
||||
test_name)::gtest_registering_dummy_ = \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() CV_TEST_BODY_IMPL \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() CV_TEST_BODY_IMPL( #test_case_name "_" #test_name ) \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::Body()
|
||||
|
||||
#endif // OPENCV_TS_EXT_HPP
|
||||
|
@ -1,7 +1,8 @@
|
||||
#ifndef OPENCV_TS_PERF_HPP
|
||||
#define OPENCV_TS_PERF_HPP
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#include "ts_gtest.h"
|
||||
#include "ts_ext.hpp"
|
||||
|
||||
@ -537,7 +538,7 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
|
||||
protected:\
|
||||
virtual void PerfTestBody();\
|
||||
};\
|
||||
TEST_F(test_case_name, test_name){ RunPerfTestBody(); }\
|
||||
TEST_F(test_case_name, test_name){ CV_TRACE_REGION("PERF_TEST: " #test_case_name "_" #test_name); RunPerfTestBody(); }\
|
||||
}\
|
||||
void PERF_PROXY_NAMESPACE_NAME_(test_case_name, test_name)::test_case_name::PerfTestBody()
|
||||
|
||||
@ -575,7 +576,7 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
|
||||
protected:\
|
||||
virtual void PerfTestBody();\
|
||||
};\
|
||||
TEST_F(fixture, testname){ RunPerfTestBody(); }\
|
||||
TEST_F(fixture, testname){ CV_TRACE_REGION("PERF_TEST: " #fixture "_" #testname); RunPerfTestBody(); }\
|
||||
}\
|
||||
void PERF_PROXY_NAMESPACE_NAME_(fixture, testname)::fixture::PerfTestBody()
|
||||
|
||||
@ -608,7 +609,7 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
|
||||
protected:\
|
||||
virtual void PerfTestBody();\
|
||||
};\
|
||||
TEST_P(fixture##_##name, name /*perf*/){ RunPerfTestBody(); }\
|
||||
TEST_P(fixture##_##name, name /*perf*/){ CV_TRACE_REGION("PERF_TEST: " #fixture "_" #name); RunPerfTestBody(); }\
|
||||
INSTANTIATE_TEST_CASE_P(/*none*/, fixture##_##name, params);\
|
||||
void fixture##_##name::PerfTestBody()
|
||||
|
||||
@ -631,7 +632,10 @@ void dumpOpenCLDevice();
|
||||
#define TEST_DUMP_OCL_INFO
|
||||
#endif
|
||||
|
||||
|
||||
#define CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, ...) \
|
||||
CV_TRACE_FUNCTION(); \
|
||||
{ CV_TRACE_REGION("INIT"); \
|
||||
::perf::Regression::Init(#modulename); \
|
||||
::perf::TestBase::Init(std::vector<std::string>(impls, impls + sizeof impls / sizeof *impls), \
|
||||
argc, argv); \
|
||||
@ -641,6 +645,7 @@ void dumpOpenCLDevice();
|
||||
::perf::TestBase::RecordRunParameters(); \
|
||||
__CV_TEST_EXEC_ARGS(__VA_ARGS__) \
|
||||
TEST_DUMP_OCL_INFO \
|
||||
} \
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
// impls must be an array, not a pointer; "plain" should always be one of the implementations
|
||||
@ -657,10 +662,20 @@ int main(int argc, char **argv)\
|
||||
CV_PERF_TEST_MAIN_INTERNALS(modulename, plain_only, __VA_ARGS__)\
|
||||
}
|
||||
|
||||
//! deprecated
|
||||
#define TEST_CYCLE_N(n) for(declare.iterations(n); next() && startTimer(); stopTimer())
|
||||
//! deprecated
|
||||
#define TEST_CYCLE() for(; next() && startTimer(); stopTimer())
|
||||
//! deprecated
|
||||
#define TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); next() && startTimer(); stopTimer()) for(int r = 0; r < runsNum; ++r)
|
||||
|
||||
#define PERF_SAMPLE_BEGIN() \
|
||||
for(; next() && startTimer(); stopTimer()) \
|
||||
{ \
|
||||
CV_TRACE_REGION("iteration");
|
||||
#define PERF_SAMPLE_END() \
|
||||
}
|
||||
|
||||
namespace perf
|
||||
{
|
||||
namespace comparators
|
||||
|
@ -49,6 +49,9 @@ if __name__ == "__main__":
|
||||
parser.add_argument("--serial", metavar="serial number", default="", help="Android: directs command to the USB device or emulator with the given serial number")
|
||||
parser.add_argument("--package", metavar="package", default="", help="Android: run jUnit tests for specified package")
|
||||
|
||||
parser.add_argument("--trace", action="store_true", default=False, help="Trace: enable OpenCV tracing")
|
||||
parser.add_argument("--trace_dump", metavar="trace_dump", default=-1, help="Trace: dump highlight calls (specify max entries count, 0 - dump all)")
|
||||
|
||||
args, other_args = parser.parse_known_args()
|
||||
|
||||
log.setLevel(logging.DEBUG if args.verbose else logging.INFO)
|
||||
|
@ -4,6 +4,8 @@ import datetime
|
||||
from run_utils import *
|
||||
from run_long import LONG_TESTS_DEBUG_VALGRIND, longTestFilter
|
||||
|
||||
timestamp = datetime.datetime.now()
|
||||
|
||||
class TestSuite(object):
|
||||
def __init__(self, options, cache):
|
||||
self.options = options
|
||||
@ -20,7 +22,8 @@ class TestSuite(object):
|
||||
res.append("CUDA")
|
||||
return res
|
||||
|
||||
def getLogName(self, app, timestamp):
|
||||
def getLogBaseName(self, app):
|
||||
global timestamp
|
||||
app = self.getAlias(app)
|
||||
rev = self.cache.getGitVersion()
|
||||
if isinstance(timestamp, datetime.datetime):
|
||||
@ -34,7 +37,10 @@ class TestSuite(object):
|
||||
lname = "_".join([p for p in pieces if p])
|
||||
lname = re.sub(r'[\(\)\[\]\s,]', '_', lname)
|
||||
l = re.sub(r'_+', '_', lname)
|
||||
return l + ".xml"
|
||||
return l
|
||||
|
||||
def getLogName(self, app):
|
||||
return self.getLogBaseName(app) + '.xml'
|
||||
|
||||
def listTests(self, short = False, main = False):
|
||||
if len(self.tests) == 0:
|
||||
@ -138,10 +144,25 @@ class TestSuite(object):
|
||||
if isColorEnabled(args):
|
||||
args.append("--gtest_color=yes")
|
||||
cmd = self.wrapInValgrind([exe] + args)
|
||||
env = {}
|
||||
if not self.options.valgrind and self.options.trace:
|
||||
env['OPENCV_TRACE'] = '1'
|
||||
env['OPENCV_TRACE_LOCATION'] = 'OpenCVTrace-{}'.format(self.getLogBaseName(exe))
|
||||
env['OPENCV_TRACE_SYNC_OPENCL'] = '1'
|
||||
tempDir = TempEnvDir('OPENCV_TEMP_PATH', "__opencv_temp.")
|
||||
tempDir.init()
|
||||
log.warning("Run: %s" % " ".join(cmd))
|
||||
ret = execute(cmd, cwd = workingDir)
|
||||
ret = execute(cmd, cwd = workingDir, env=env)
|
||||
try:
|
||||
if not self.options.valgrind and self.options.trace and int(self.options.trace_dump) >= 0:
|
||||
import trace_profiler
|
||||
trace = trace_profiler.Trace(env['OPENCV_TRACE_LOCATION']+'.txt')
|
||||
trace.process()
|
||||
trace.dump(max_entries=int(self.options.trace_dump))
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
pass
|
||||
tempDir.clean()
|
||||
hostlogpath = os.path.join(workingDir, logfile)
|
||||
if os.path.isfile(hostlogpath):
|
||||
@ -157,7 +178,6 @@ class TestSuite(object):
|
||||
args = args[:]
|
||||
logs = []
|
||||
test_list = self.getTestList(tests, black)
|
||||
date = datetime.datetime.now()
|
||||
if len(test_list) != 1:
|
||||
args = [a for a in args if not a.startswith("--gtest_output=")]
|
||||
ret = 0
|
||||
@ -170,7 +190,7 @@ class TestSuite(object):
|
||||
else:
|
||||
userlog = [a for a in args if a.startswith("--gtest_output=")]
|
||||
if len(userlog) == 0:
|
||||
logname = self.getLogName(exe, date)
|
||||
logname = self.getLogName(exe)
|
||||
more_args.append("--gtest_output=xml:" + logname)
|
||||
else:
|
||||
logname = userlog[0][userlog[0].find(":")+1:]
|
||||
|
@ -25,10 +25,12 @@ class Err(Exception):
|
||||
def execute(cmd, silent = False, cwd = ".", env = None):
|
||||
try:
|
||||
log.debug("Run: %s", cmd)
|
||||
if env:
|
||||
if env is not None:
|
||||
for k in env:
|
||||
log.debug(" Environ: %s=%s", k, env[k])
|
||||
env = os.environ.update(env)
|
||||
new_env = os.environ.copy()
|
||||
new_env.update(env)
|
||||
env = new_env
|
||||
if silent:
|
||||
return check_output(cmd, stderr = STDOUT, cwd = cwd, env = env).decode("latin-1")
|
||||
else:
|
||||
|
435
modules/ts/misc/trace_profiler.py
Normal file
435
modules/ts/misc/trace_profiler.py
Normal file
@ -0,0 +1,435 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import csv
|
||||
from pprint import pprint
|
||||
from collections import deque
|
||||
|
||||
# trace.hpp
|
||||
REGION_FLAG_IMPL_MASK = 15 << 16;
|
||||
REGION_FLAG_IMPL_IPP = 1 << 16;
|
||||
REGION_FLAG_IMPL_OPENCL = 2 << 16;
|
||||
|
||||
DEBUG = False
|
||||
|
||||
if DEBUG:
|
||||
dprint = print
|
||||
dpprint = pprint
|
||||
else:
|
||||
def dprint(args, **kwargs):
|
||||
pass
|
||||
def dpprint(args, **kwargs):
|
||||
pass
|
||||
|
||||
def tryNum(s):
|
||||
if s.startswith('0x'):
|
||||
try:
|
||||
return int(s, 16)
|
||||
except ValueError:
|
||||
pass
|
||||
try:
|
||||
return int(s)
|
||||
except ValueError:
|
||||
pass
|
||||
if sys.version_info[0] < 3:
|
||||
try:
|
||||
return long(s)
|
||||
except ValueError:
|
||||
pass
|
||||
return s
|
||||
|
||||
def formatTimestamp(t):
|
||||
return "%.3f" % (t * 1e-6)
|
||||
|
||||
try:
|
||||
from statistics import median
|
||||
except ImportError:
|
||||
def median(lst):
|
||||
sortedLst = sorted(lst)
|
||||
lstLen = len(lst)
|
||||
index = (lstLen - 1) // 2
|
||||
if (lstLen % 2):
|
||||
return sortedLst[index]
|
||||
else:
|
||||
return (sortedLst[index] + sortedLst[index + 1]) * 0.5
|
||||
|
||||
def getCXXFunctionName(spec):
|
||||
def dropParams(spec):
|
||||
pos = len(spec) - 1
|
||||
depth = 0
|
||||
while pos >= 0:
|
||||
if spec[pos] == ')':
|
||||
depth = depth + 1
|
||||
elif spec[pos] == '(':
|
||||
depth = depth - 1
|
||||
if depth == 0:
|
||||
if pos == 0 or spec[pos - 1] in ['#', ':']:
|
||||
res = dropParams(spec[pos+1:-1])
|
||||
return (spec[:pos] + res[0], res[1])
|
||||
return (spec[:pos], spec[pos:])
|
||||
pos = pos - 1
|
||||
return (spec, '')
|
||||
|
||||
def extractName(spec):
|
||||
pos = len(spec) - 1
|
||||
inName = False
|
||||
while pos >= 0:
|
||||
if spec[pos] == ' ':
|
||||
if inName:
|
||||
return spec[pos+1:]
|
||||
elif spec[pos].isalnum():
|
||||
inName = True
|
||||
pos = pos - 1
|
||||
return spec
|
||||
|
||||
if spec.startswith('IPP') or spec.startswith('OpenCL'):
|
||||
prefix_size = len('IPP') if spec.startswith('IPP') else len('OpenCL')
|
||||
prefix = spec[:prefix_size]
|
||||
if prefix_size < len(spec) and spec[prefix_size] in ['#', ':']:
|
||||
prefix = prefix + spec[prefix_size]
|
||||
prefix_size = prefix_size + 1
|
||||
begin = prefix_size
|
||||
while begin < len(spec):
|
||||
if spec[begin].isalnum() or spec[begin] in ['_', ':']:
|
||||
break
|
||||
begin = begin + 1
|
||||
if begin == len(spec):
|
||||
return spec
|
||||
end = begin
|
||||
while end < len(spec):
|
||||
if not (spec[end].isalnum() or spec[end] in ['_', ':']):
|
||||
break
|
||||
end = end + 1
|
||||
return prefix + spec[begin:end]
|
||||
|
||||
spec = spec.replace(') const', ')') # const methods
|
||||
(ret_type_name, params) = dropParams(spec)
|
||||
name = extractName(ret_type_name)
|
||||
if 'operator' in name:
|
||||
return name + params
|
||||
if name.startswith('&'):
|
||||
return name[1:]
|
||||
return name
|
||||
|
||||
stack_size = 10
|
||||
|
||||
class Trace:
|
||||
def __init__(self, filename=None):
|
||||
self.tasks = {}
|
||||
self.tasks_list = []
|
||||
self.locations = {}
|
||||
self.threads_stack = {}
|
||||
self.pending_files = deque()
|
||||
if filename:
|
||||
self.load(filename)
|
||||
|
||||
class TraceTask:
|
||||
def __init__(self, threadID, taskID, locationID, beginTimestamp):
|
||||
self.threadID = threadID
|
||||
self.taskID = taskID
|
||||
self.locationID = locationID
|
||||
self.beginTimestamp = beginTimestamp
|
||||
self.endTimestamp = None
|
||||
self.parentTaskID = None
|
||||
self.parentThreadID = None
|
||||
self.childTask = []
|
||||
self.selfTimeIPP = 0
|
||||
self.selfTimeOpenCL = 0
|
||||
self.totalTimeIPP = 0
|
||||
self.totalTimeOpenCL = 0
|
||||
|
||||
def __repr__(self):
|
||||
return "TID={} ID={} loc={} parent={}:{} begin={} end={} IPP={}/{} OpenCL={}/{}".format(
|
||||
self.threadID, self.taskID, self.locationID, self.parentThreadID, self.parentTaskID,
|
||||
self.beginTimestamp, self.endTimestamp, self.totalTimeIPP, self.selfTimeIPP, self.totalTimeOpenCL, self.selfTimeOpenCL)
|
||||
|
||||
|
||||
class TraceLocation:
|
||||
def __init__(self, locationID, filename, line, name, flags):
|
||||
self.locationID = locationID
|
||||
self.filename = os.path.split(filename)[1]
|
||||
self.line = line
|
||||
self.name = getCXXFunctionName(name)
|
||||
self.flags = flags
|
||||
|
||||
def __str__(self):
|
||||
return "{}#{}:{}".format(self.name, self.filename, self.line)
|
||||
|
||||
def __repr__(self):
|
||||
return "ID={} {}:{}:{}".format(self.locationID, self.filename, self.line, self.name)
|
||||
|
||||
def parse_file(self, filename):
|
||||
dprint("Process file: '{}'".format(filename))
|
||||
with open(filename) as infile:
|
||||
for line in infile:
|
||||
line = str(line).strip()
|
||||
if line[0] == "#":
|
||||
if line.startswith("#thread file:"):
|
||||
name = str(line.split(':', 1)[1]).strip()
|
||||
self.pending_files.append(os.path.join(os.path.split(filename)[0], name))
|
||||
continue
|
||||
self.parse_line(line)
|
||||
|
||||
def parse_line(self, line):
|
||||
opts = line.split(',')
|
||||
dpprint(opts)
|
||||
if opts[0] == 'l':
|
||||
opts = list(csv.reader([line]))[0] # process quote more
|
||||
locationID = int(opts[1])
|
||||
filename = str(opts[2])
|
||||
line = int(opts[3])
|
||||
name = opts[4]
|
||||
flags = tryNum(opts[5])
|
||||
self.locations[locationID] = self.TraceLocation(locationID, filename, line, name, flags)
|
||||
return
|
||||
extra_opts = {}
|
||||
for e in opts[5:]:
|
||||
if not '=' in e:
|
||||
continue
|
||||
(k, v) = e.split('=')
|
||||
extra_opts[k] = tryNum(v)
|
||||
if extra_opts:
|
||||
dpprint(extra_opts)
|
||||
threadID = None
|
||||
taskID = None
|
||||
locationID = None
|
||||
ts = None
|
||||
if opts[0] in ['b', 'e']:
|
||||
threadID = int(opts[1])
|
||||
taskID = int(opts[4])
|
||||
locationID = int(opts[3])
|
||||
ts = tryNum(opts[2])
|
||||
thread_stack = None
|
||||
currentTask = (None, None)
|
||||
if threadID is not None:
|
||||
if not threadID in self.threads_stack:
|
||||
thread_stack = deque()
|
||||
self.threads_stack[threadID] = thread_stack
|
||||
else:
|
||||
thread_stack = self.threads_stack[threadID]
|
||||
currentTask = None if not thread_stack else thread_stack[-1]
|
||||
t = (threadID, taskID)
|
||||
if opts[0] == 'b':
|
||||
assert not t in self.tasks, "Duplicate task: " + str(t) + repr(self.tasks[t])
|
||||
task = self.TraceTask(threadID, taskID, locationID, ts)
|
||||
self.tasks[t] = task
|
||||
self.tasks_list.append(task)
|
||||
thread_stack.append((threadID, taskID))
|
||||
if currentTask:
|
||||
task.parentThreadID = currentTask[0]
|
||||
task.parentTaskID = currentTask[1]
|
||||
if 'parentThread' in extra_opts:
|
||||
task.parentThreadID = extra_opts['parentThread']
|
||||
if 'parent' in extra_opts:
|
||||
task.parentTaskID = extra_opts['parent']
|
||||
if opts[0] == 'e':
|
||||
task = self.tasks[t]
|
||||
task.endTimestamp = ts
|
||||
if 'tIPP' in extra_opts:
|
||||
task.selfTimeIPP = extra_opts['tIPP']
|
||||
if 'tOCL' in extra_opts:
|
||||
task.selfTimeOpenCL = extra_opts['tOCL']
|
||||
thread_stack.pop()
|
||||
|
||||
def load(self, filename):
|
||||
self.pending_files.append(filename)
|
||||
if DEBUG:
|
||||
with open(filename, 'r') as f:
|
||||
print(f.read(), end='')
|
||||
while self.pending_files:
|
||||
self.parse_file(self.pending_files.pop())
|
||||
|
||||
def getParentTask(self, task):
|
||||
return self.tasks.get((task.parentThreadID, task.parentTaskID), None)
|
||||
|
||||
def process(self):
|
||||
self.tasks_list.sort(key=lambda x: x.beginTimestamp)
|
||||
|
||||
parallel_for_location = None
|
||||
for (id, l) in self.locations.items():
|
||||
if l.name == 'parallel_for':
|
||||
parallel_for_location = l.locationID
|
||||
break
|
||||
|
||||
for task in self.tasks_list:
|
||||
try:
|
||||
task.duration = task.endTimestamp - task.beginTimestamp
|
||||
task.selfDuration = task.duration
|
||||
except:
|
||||
task.duration = None
|
||||
task.selfDuration = None
|
||||
task.totalTimeIPP = task.selfTimeIPP
|
||||
task.totalTimeOpenCL = task.selfTimeOpenCL
|
||||
|
||||
dpprint(self.tasks)
|
||||
dprint("Calculate total times")
|
||||
|
||||
for task in self.tasks_list:
|
||||
parentTask = self.getParentTask(task)
|
||||
if parentTask:
|
||||
parentTask.selfDuration = parentTask.selfDuration - task.duration
|
||||
parentTask.childTask.append(task)
|
||||
timeIPP = task.selfTimeIPP
|
||||
timeOpenCL = task.selfTimeOpenCL
|
||||
while parentTask:
|
||||
if parentTask.locationID == parallel_for_location: # TODO parallel_for
|
||||
break
|
||||
parentLocation = self.locations[parentTask.locationID]
|
||||
if (parentLocation.flags & REGION_FLAG_IMPL_MASK) == REGION_FLAG_IMPL_IPP:
|
||||
parentTask.selfTimeIPP = parentTask.selfTimeIPP - timeIPP
|
||||
timeIPP = 0
|
||||
else:
|
||||
parentTask.totalTimeIPP = parentTask.totalTimeIPP + timeIPP
|
||||
if (parentLocation.flags & REGION_FLAG_IMPL_MASK) == REGION_FLAG_IMPL_OPENCL:
|
||||
parentTask.selfTimeOpenCL = parentTask.selfTimeOpenCL - timeOpenCL
|
||||
timeOpenCL = 0
|
||||
else:
|
||||
parentTask.totalTimeOpenCL = parentTask.totalTimeOpenCL + timeOpenCL
|
||||
parentTask = self.getParentTask(parentTask)
|
||||
|
||||
dpprint(self.tasks)
|
||||
dprint("Calculate total times (parallel_for)")
|
||||
|
||||
for task in self.tasks_list:
|
||||
if task.locationID == parallel_for_location:
|
||||
task.selfDuration = 0
|
||||
childDuration = sum([t.duration for t in task.childTask])
|
||||
if task.duration == 0 or childDuration == 0:
|
||||
continue
|
||||
timeCoef = task.duration / float(childDuration)
|
||||
childTimeIPP = sum([t.totalTimeIPP for t in task.childTask])
|
||||
childTimeOpenCL = sum([t.totalTimeOpenCL for t in task.childTask])
|
||||
if childTimeIPP == 0 and childTimeOpenCL == 0:
|
||||
continue
|
||||
timeIPP = childTimeIPP * timeCoef
|
||||
timeOpenCL = childTimeOpenCL * timeCoef
|
||||
parentTask = task
|
||||
while parentTask:
|
||||
parentLocation = self.locations[parentTask.locationID]
|
||||
if (parentLocation.flags & REGION_FLAG_IMPL_MASK) == REGION_FLAG_IMPL_IPP:
|
||||
parentTask.selfTimeIPP = parentTask.selfTimeIPP - timeIPP
|
||||
timeIPP = 0
|
||||
else:
|
||||
parentTask.totalTimeIPP = parentTask.totalTimeIPP + timeIPP
|
||||
if (parentLocation.flags & REGION_FLAG_IMPL_MASK) == REGION_FLAG_IMPL_OPENCL:
|
||||
parentTask.selfTimeOpenCL = parentTask.selfTimeOpenCL - timeOpenCL
|
||||
timeOpenCL = 0
|
||||
else:
|
||||
parentTask.totalTimeOpenCL = parentTask.totalTimeOpenCL + timeOpenCL
|
||||
parentTask = self.getParentTask(parentTask)
|
||||
|
||||
dpprint(self.tasks)
|
||||
dprint("Done")
|
||||
|
||||
def dump(self, max_entries):
|
||||
assert isinstance(max_entries, int)
|
||||
|
||||
class CallInfo():
|
||||
def __init__(self, callID):
|
||||
self.callID = callID
|
||||
self.totalTimes = []
|
||||
self.selfTimes = []
|
||||
self.threads = set()
|
||||
self.selfTimesIPP = []
|
||||
self.selfTimesOpenCL = []
|
||||
self.totalTimesIPP = []
|
||||
self.totalTimesOpenCL = []
|
||||
|
||||
calls = {}
|
||||
|
||||
for currentTask in self.tasks_list:
|
||||
task = currentTask
|
||||
callID = []
|
||||
for i in range(stack_size):
|
||||
callID.append(task.locationID)
|
||||
task = self.getParentTask(task)
|
||||
if not task:
|
||||
break
|
||||
callID = tuple(callID)
|
||||
if not callID in calls:
|
||||
call = CallInfo(callID)
|
||||
calls[callID] = call
|
||||
else:
|
||||
call = calls[callID]
|
||||
call.totalTimes.append(currentTask.duration)
|
||||
call.selfTimes.append(currentTask.selfDuration)
|
||||
call.threads.add(currentTask.threadID)
|
||||
call.selfTimesIPP.append(currentTask.selfTimeIPP)
|
||||
call.selfTimesOpenCL.append(currentTask.selfTimeOpenCL)
|
||||
call.totalTimesIPP.append(currentTask.totalTimeIPP)
|
||||
call.totalTimesOpenCL.append(currentTask.totalTimeOpenCL)
|
||||
|
||||
dpprint(self.tasks)
|
||||
dpprint(self.locations)
|
||||
dpprint(calls)
|
||||
|
||||
calls_self_sum = {k: sum(v.selfTimes) for (k, v) in calls.items()}
|
||||
calls_total_sum = {k: sum(v.totalTimes) for (k, v) in calls.items()}
|
||||
calls_median = {k: median(v.selfTimes) for (k, v) in calls.items()}
|
||||
calls_sorted = sorted(calls.keys(), key=lambda x: calls_self_sum[x], reverse=True)
|
||||
|
||||
calls_self_sum_IPP = {k: sum(v.selfTimesIPP) for (k, v) in calls.items()}
|
||||
calls_total_sum_IPP = {k: sum(v.totalTimesIPP) for (k, v) in calls.items()}
|
||||
|
||||
calls_self_sum_OpenCL = {k: sum(v.selfTimesOpenCL) for (k, v) in calls.items()}
|
||||
calls_total_sum_OpenCL = {k: sum(v.totalTimesOpenCL) for (k, v) in calls.items()}
|
||||
|
||||
if max_entries > 0 and len(calls_sorted) > max_entries:
|
||||
calls_sorted = calls_sorted[:max_entries]
|
||||
|
||||
def formatPercents(p):
|
||||
if p is not None:
|
||||
return "{:>3d}".format(int(p*100))
|
||||
return ''
|
||||
|
||||
name_width = 70
|
||||
timestamp_width = 12
|
||||
def fmtTS():
|
||||
return '{:>' + str(timestamp_width) + '}'
|
||||
fmt = "{:>3} {:<"+str(name_width)+"} {:>8} {:>3}"+((' '+fmtTS())*5)+((' '+fmtTS()+' {:>3}')*2)
|
||||
fmt2 = "{:>3} {:<"+str(name_width)+"} {:>8} {:>3}"+((' '+fmtTS())*5)+((' '+fmtTS()+' {:>3}')*2)
|
||||
print(fmt.format("ID", "name", "count", "thr", "min", "max", "median", "avg", "*self*", "IPP", "%", "OpenCL", "%"))
|
||||
print(fmt2.format("", "", "", "", "t-min", "t-max", "t-median", "t-avg", "total", "t-IPP", "%", "t-OpenCL", "%"))
|
||||
for (index, callID) in enumerate(calls_sorted):
|
||||
call_self_times = calls[callID].selfTimes
|
||||
loc0 = self.locations[callID[0]]
|
||||
loc_array = [] # [str(callID)]
|
||||
for (i, l) in enumerate(callID):
|
||||
loc = self.locations[l]
|
||||
loc_array.append(loc.name if i > 0 else str(loc))
|
||||
loc_str = '|'.join(loc_array)
|
||||
if len(loc_str) > name_width: loc_str = loc_str[:name_width-3]+'...'
|
||||
print(fmt.format(index + 1, loc_str, len(call_self_times),
|
||||
len(calls[callID].threads),
|
||||
formatTimestamp(min(call_self_times)),
|
||||
formatTimestamp(max(call_self_times)),
|
||||
formatTimestamp(calls_median[callID]),
|
||||
formatTimestamp(sum(call_self_times)/float(len(call_self_times))),
|
||||
formatTimestamp(sum(call_self_times)),
|
||||
formatTimestamp(calls_self_sum_IPP[callID]),
|
||||
formatPercents(calls_self_sum_IPP[callID] / float(calls_self_sum[callID])) if calls_self_sum[callID] > 0 else formatPercents(None),
|
||||
formatTimestamp(calls_self_sum_OpenCL[callID]),
|
||||
formatPercents(calls_self_sum_OpenCL[callID] / float(calls_self_sum[callID])) if calls_self_sum[callID] > 0 else formatPercents(None),
|
||||
))
|
||||
call_total_times = calls[callID].totalTimes
|
||||
print(fmt2.format("", "", "", "",
|
||||
formatTimestamp(min(call_total_times)),
|
||||
formatTimestamp(max(call_total_times)),
|
||||
formatTimestamp(median(call_total_times)),
|
||||
formatTimestamp(sum(call_total_times)/float(len(call_total_times))),
|
||||
formatTimestamp(sum(call_total_times)),
|
||||
formatTimestamp(calls_total_sum_IPP[callID]),
|
||||
formatPercents(calls_total_sum_IPP[callID] / float(calls_total_sum[callID])) if calls_total_sum[callID] > 0 else formatPercents(None),
|
||||
formatTimestamp(calls_total_sum_OpenCL[callID]),
|
||||
formatPercents(calls_total_sum_OpenCL[callID] / float(calls_total_sum[callID])) if calls_total_sum[callID] > 0 else formatPercents(None),
|
||||
))
|
||||
print()
|
||||
|
||||
if __name__ == "__main__":
|
||||
tracefile = sys.argv[1] if len(sys.argv) > 1 else 'OpenCVTrace.txt'
|
||||
count = int(sys.argv[2]) if len(sys.argv) > 2 else 10
|
||||
trace = Trace(tracefile)
|
||||
trace.process()
|
||||
trace.dump(max_entries = count)
|
||||
print("OK")
|
@ -1,7 +1,5 @@
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv2/core/private.hpp"
|
||||
#include "opencv2/ts.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/core/private.hpp"
|
||||
|
||||
#ifdef GTEST_LINKED_AS_SHARED_LIBRARY
|
||||
#error ts module should not have GTEST_LINKED_AS_SHARED_LIBRARY defined
|
||||
|
@ -225,6 +225,7 @@ bool BaseTest::can_do_fast_forward()
|
||||
|
||||
void BaseTest::safe_run( int start_from )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
read_params( ts->get_file_storage() );
|
||||
ts->update_context( 0, -1, true );
|
||||
ts->update_context( this, -1, true );
|
||||
|
@ -954,6 +954,8 @@ void TestBase::Init(int argc, const char* const argv[])
|
||||
void TestBase::Init(const std::vector<std::string> & availableImpls,
|
||||
int argc, const char* const argv[])
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
available_impls = availableImpls;
|
||||
|
||||
const std::string command_line_keys =
|
||||
@ -1182,6 +1184,7 @@ enum PERF_STRATEGY TestBase::getCurrentModulePerformanceStrategy()
|
||||
|
||||
int64 TestBase::_calibrate()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
class _helper : public ::perf::TestBase
|
||||
{
|
||||
public:
|
||||
@ -1248,6 +1251,7 @@ void TestBase::declareArray(SizeVector& sizes, cv::InputOutputArray a, WarmUpTyp
|
||||
|
||||
void TestBase::warmup(cv::InputOutputArray a, WarmUpType wtype)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
if (a.empty())
|
||||
return;
|
||||
else if (a.isUMat())
|
||||
@ -1419,6 +1423,7 @@ bool TestBase::next()
|
||||
median_ms > perf_validation_time_threshold_ms &&
|
||||
(grow || metrics.stddev > perf_stability_criteria * fabs(metrics.mean)))
|
||||
{
|
||||
CV_TRACE_REGION("idle_delay");
|
||||
printf("Performance is unstable, it may be a result of overheat problems\n");
|
||||
printf("Idle delay for %d ms... \n", perf_validation_idle_delay_ms);
|
||||
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
|
||||
@ -1682,8 +1687,17 @@ void TestBase::validateMetrics()
|
||||
|
||||
void TestBase::reportMetrics(bool toJUnitXML)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
performance_metrics& m = calcMetrics();
|
||||
|
||||
CV_TRACE_ARG_VALUE(samples, "samples", (int64)m.samples);
|
||||
CV_TRACE_ARG_VALUE(outliers, "outliers", (int64)m.outliers);
|
||||
CV_TRACE_ARG_VALUE(median, "mean_ms", (double)(m.mean * 1000.0f / metrics.frequency));
|
||||
CV_TRACE_ARG_VALUE(median, "median_ms", (double)(m.median * 1000.0f / metrics.frequency));
|
||||
CV_TRACE_ARG_VALUE(stddev, "stddev_ms", (double)(m.stddev * 1000.0f / metrics.frequency));
|
||||
CV_TRACE_ARG_VALUE(stddev_percents, "stddev_percents", (double)(m.stddev / (double)m.mean * 100.0f));
|
||||
|
||||
if (m.terminationReason == performance_metrics::TERM_SKIP_TEST)
|
||||
{
|
||||
if (toJUnitXML)
|
||||
|
@ -590,28 +590,33 @@ VideoCapture::VideoCapture()
|
||||
|
||||
VideoCapture::VideoCapture(const String& filename, int apiPreference)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
open(filename, apiPreference);
|
||||
}
|
||||
|
||||
VideoCapture::VideoCapture(const String& filename)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
open(filename, CAP_ANY);
|
||||
}
|
||||
|
||||
VideoCapture::VideoCapture(int index)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
open(index);
|
||||
}
|
||||
|
||||
VideoCapture::~VideoCapture()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
icap.release();
|
||||
cap.release();
|
||||
}
|
||||
|
||||
bool VideoCapture::open(const String& filename, int apiPreference)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
if (isOpened()) release();
|
||||
icap = IVideoCapture_create(filename);
|
||||
@ -624,14 +629,14 @@ bool VideoCapture::open(const String& filename, int apiPreference)
|
||||
|
||||
bool VideoCapture::open(const String& filename)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
return open(filename, CAP_ANY);
|
||||
}
|
||||
|
||||
bool VideoCapture::open(int index)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
if (isOpened()) release();
|
||||
icap = IVideoCapture_create(index);
|
||||
@ -642,6 +647,8 @@ bool VideoCapture::open(int index)
|
||||
}
|
||||
bool VideoCapture::open(int cameraNum, int apiPreference)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
cameraNum = cameraNum + apiPreference;
|
||||
return open(cameraNum);
|
||||
}
|
||||
@ -653,6 +660,7 @@ bool VideoCapture::isOpened() const
|
||||
|
||||
void VideoCapture::release()
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
icap.release();
|
||||
cap.release();
|
||||
}
|
||||
|
@ -42,32 +42,10 @@
|
||||
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
|
||||
//
|
||||
//M*/
|
||||
#include "opencv2/ts.hpp"
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
||||
#define __OPENCV_TEST_PRECOMP_HPP__
|
||||
|
||||
#include <opencv2/core/version.hpp>
|
||||
#include <opencv2/viz/vizcore.hpp>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
Mat imread(const String& filename, int flags = 1);
|
||||
}
|
||||
|
||||
#if CV_MAJOR_VERSION < 3
|
||||
#include "opencv2/ts/ts.hpp"
|
||||
#else
|
||||
#include "opencv2/ts.hpp"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@ -108,5 +86,3 @@ namespace cv
|
||||
return 0.114 * chs[0] + 0.58 * chs[1] + 0.3 * chs[2];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
void tutorial2()
|
||||
static void tutorial2()
|
||||
{
|
||||
/// Create a window
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
@ -6,7 +6,7 @@ using namespace std;
|
||||
/**
|
||||
* @function main
|
||||
*/
|
||||
void tutorial3(bool camera_pov)
|
||||
static void tutorial3(bool camera_pov)
|
||||
{
|
||||
/// Create a window
|
||||
viz::Viz3d myWindow("Coordinate Frame");
|
||||
|
92
samples/cpp/application_trace.cpp
Normal file
92
samples/cpp/application_trace.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
/* OpenCV Application Tracing support demo. */
|
||||
#include <iostream>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/core/utils/trace.hpp>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
static void process_frame(const cv::UMat& frame)
|
||||
{
|
||||
CV_TRACE_FUNCTION(); // OpenCV Trace macro for function
|
||||
|
||||
imshow("Live", frame);
|
||||
|
||||
UMat gray, processed;
|
||||
cv::cvtColor(frame, gray, COLOR_BGR2GRAY);
|
||||
Canny(gray, processed, 32, 64, 3);
|
||||
imshow("Processed", processed);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
||||
cv::CommandLineParser parser(argc, argv,
|
||||
"{help h ? | | help message}"
|
||||
"{n | 100 | number of frames to process }"
|
||||
"{@video | 0 | video filename or cameraID }"
|
||||
);
|
||||
if (parser.has("help"))
|
||||
{
|
||||
parser.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
VideoCapture capture;
|
||||
std::string video = parser.get<string>("@video");
|
||||
if (video.size() == 1 && isdigit(video[0]))
|
||||
capture.open(parser.get<int>("@video"));
|
||||
else
|
||||
capture.open(video);
|
||||
int nframes = 0;
|
||||
if (capture.isOpened())
|
||||
{
|
||||
nframes = (int)capture.get(CAP_PROP_FRAME_COUNT);
|
||||
cout << "Video " << video <<
|
||||
": width=" << capture.get(CAP_PROP_FRAME_WIDTH) <<
|
||||
", height=" << capture.get(CAP_PROP_FRAME_HEIGHT) <<
|
||||
", nframes=" << nframes << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Could not initialize video capturing...\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
int N = parser.get<int>("n");
|
||||
if (nframes > 0 && N > nframes)
|
||||
N = nframes;
|
||||
|
||||
cout << "Start processing..." << endl
|
||||
<< "Press ESC key to terminate" << endl;
|
||||
|
||||
UMat frame;
|
||||
for (int i = 0; N > 0 ? (i < N) : true; i++)
|
||||
{
|
||||
CV_TRACE_REGION("FRAME"); // OpenCV Trace macro for named "scope" region
|
||||
{
|
||||
CV_TRACE_REGION("read");
|
||||
capture.read(frame);
|
||||
|
||||
if (frame.empty())
|
||||
{
|
||||
cerr << "Can't capture frame: " << i << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
// OpenCV Trace macro for NEXT named region in the same C++ scope
|
||||
// Previous "read" region will be marked complete on this line.
|
||||
// Use this to eliminate unnecessary curly braces.
|
||||
CV_TRACE_REGION_NEXT("process");
|
||||
process_frame(frame);
|
||||
|
||||
CV_TRACE_REGION_NEXT("delay");
|
||||
if (waitKey(1) == 27/*ESC*/)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user