mirror of
https://git.planet-casio.com/Lephenixnoir/libprof.git
synced 2025-05-10 03:49:21 +02:00
Compare commits
No commits in common. "master" and "2.3.0" have entirely different histories.
5 changed files with 16 additions and 36 deletions
|
@ -1,8 +1,8 @@
|
||||||
# Build system for the libprof library for gint
|
# Build system for the libprof library for gint
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(libprof VERSION 2.4.0 LANGUAGES C)
|
project(libprof VERSION 2.2.1 LANGUAGES C)
|
||||||
find_package(Gint 2.4.0 REQUIRED)
|
find_package(Gint 2.2.1 REQUIRED)
|
||||||
|
|
||||||
configure_file(libprof.h libprof.h)
|
configure_file(libprof.h libprof.h)
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ target_include_directories(${NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
target_link_libraries(${NAME} Gint::Gint)
|
target_link_libraries(${NAME} Gint::Gint)
|
||||||
|
|
||||||
install(TARGETS ${NAME}
|
install(TARGETS ${NAME}
|
||||||
DESTINATION "${FXSDK_LIB}")
|
DESTINATION "${FXSDK_COMPILER_INSTALL}")
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libprof.h"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libprof.h"
|
||||||
DESTINATION "${FXSDK_INCLUDE}")
|
DESTINATION "${FXSDK_COMPILER_INSTALL}/include")
|
||||||
install(FILES cmake/FindLibProf.cmake
|
install(FILES cmake/FindLibProf.cmake
|
||||||
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
|
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
include(FindSimpleLibrary)
|
include(FindSimpleLibrary)
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
find_package(Gint 2.2.1 REQUIRED)
|
find_simple_library("libprof-${FXSDK_PLATFORM}.a" include/libprof.h
|
||||||
|
|
||||||
find_simple_library("libprof-${FXSDK_PLATFORM}.a" libprof.h
|
|
||||||
"PROF_VERSION" PATH_VAR PROF_PATH VERSION_VAR PROF_VERSION)
|
"PROF_VERSION" PATH_VAR PROF_PATH VERSION_VAR PROF_VERSION)
|
||||||
|
|
||||||
find_package_handle_standard_args(LibProf
|
find_package_handle_standard_args(LibProf
|
||||||
|
@ -14,6 +12,5 @@ if(LibProf_FOUND)
|
||||||
add_library(LibProf::LibProf UNKNOWN IMPORTED)
|
add_library(LibProf::LibProf UNKNOWN IMPORTED)
|
||||||
set_target_properties(LibProf::LibProf PROPERTIES
|
set_target_properties(LibProf::LibProf PROPERTIES
|
||||||
IMPORTED_LOCATION "${PROF_PATH}"
|
IMPORTED_LOCATION "${PROF_PATH}"
|
||||||
INTERFACE_LINK_OPTIONS -lprof-${FXSDK_PLATFORM}
|
INTERFACE_LINK_OPTIONS -lprof-${FXSDK_PLATFORM})
|
||||||
IMPORTED_LINK_INTERFACE_LIBRARIES Gint::Gint)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,10 +15,10 @@ install:
|
||||||
@ fxsdk build-cg install
|
@ fxsdk build-cg install
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@ if [ -e build-fx/install_manifest.txt ]; then \
|
@ if [[ -e build-fx/install_manifest.txt ]]; then \
|
||||||
xargs rm -f < build-fx/install_manifest.txt; \
|
xargs rm -f < build-fx/install_manifest.txt; \
|
||||||
fi
|
fi
|
||||||
@ if [ -e build-cg/install_manifest.txt ]; then \
|
@ if [[ -e build-cg/install_manifest.txt ]]; then \
|
||||||
xargs rm -f < build-cg/install_manifest.txt; \
|
xargs rm -f < build-cg/install_manifest.txt; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ int prof_init(void)
|
||||||
int timer = -1;
|
int timer = -1;
|
||||||
for(int t = 2; t >= 0 && timer == -1; t--)
|
for(int t = 2; t >= 0 && timer == -1; t--)
|
||||||
{
|
{
|
||||||
timer = timer_configure(t | TIMER_Pphi_4, 0xffffffff,
|
timer = timer_setup(t | TIMER_Pphi_4, 0xffffffff, callback);
|
||||||
GINT_CALL(callback));
|
|
||||||
}
|
}
|
||||||
if(timer == -1)
|
if(timer == -1)
|
||||||
{
|
{
|
||||||
|
|
28
libprof.h
28
libprof.h
|
@ -5,10 +5,6 @@
|
||||||
#ifndef LIBPROF_LIBPROF
|
#ifndef LIBPROF_LIBPROF
|
||||||
#define LIBPROF_LIBPROF
|
#define LIBPROF_LIBPROF
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <gint/defs/attributes.h>
|
#include <gint/defs/attributes.h>
|
||||||
|
|
||||||
|
@ -58,7 +54,7 @@ extern uint32_t volatile *prof_tcnt;
|
||||||
function was already executing then the deepest instance in the stack is
|
function was already executing then the deepest instance in the stack is
|
||||||
used instead of creating a new counter. */
|
used instead of creating a new counter. */
|
||||||
#define prof_enter(prof) { \
|
#define prof_enter(prof) { \
|
||||||
if(!(prof).rec++) (prof).elapsed += *prof_tcnt; \
|
if(!prof.rec++) prof.elapsed += *prof_tcnt; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prof_leave(): Stop counting time for a function
|
/* prof_leave(): Stop counting time for a function
|
||||||
|
@ -67,15 +63,7 @@ extern uint32_t volatile *prof_tcnt;
|
||||||
are not as exactly as many prof_leave()'s as prof_enter()'s then the
|
are not as exactly as many prof_leave()'s as prof_enter()'s then the
|
||||||
resulting time measure will not be relevant at all. */
|
resulting time measure will not be relevant at all. */
|
||||||
#define prof_leave(prof) { \
|
#define prof_leave(prof) { \
|
||||||
if(!--(prof).rec) (prof).elapsed -= *prof_tcnt; \
|
if(!--prof.rec) prof.elapsed -= *prof_tcnt; \
|
||||||
}
|
|
||||||
|
|
||||||
/* Variant of prof_enter()/prof_leave() for non-recursive contexts */
|
|
||||||
#define prof_enter_norec(prof) { \
|
|
||||||
(prof).elapsed += *prof_tcnt; \
|
|
||||||
}
|
|
||||||
#define prof_leave_norec(prof) { \
|
|
||||||
(prof).elapsed -= *prof_tcnt; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prof_exec(): Measure a single block of code
|
/* prof_exec(): Measure a single block of code
|
||||||
|
@ -87,11 +75,11 @@ extern uint32_t volatile *prof_tcnt;
|
||||||
exec_code();
|
exec_code();
|
||||||
}); */
|
}); */
|
||||||
#define prof_exec(code) ({ \
|
#define prof_exec(code) ({ \
|
||||||
prof_t _prof = prof_make(); \
|
prof_t prof = prof_make(); \
|
||||||
prof_enter(_prof); \
|
prof_enter(prof); \
|
||||||
code; \
|
code; \
|
||||||
prof_leave(_prof); \
|
prof_leave(prof); \
|
||||||
prof_time(_prof); \
|
prof_time(prof); \
|
||||||
})
|
})
|
||||||
|
|
||||||
//---
|
//---
|
||||||
|
@ -102,8 +90,4 @@ extern uint32_t volatile *prof_tcnt;
|
||||||
Should only be called when the context is not currently executing. */
|
Should only be called when the context is not currently executing. */
|
||||||
uint32_t prof_time(prof_t prof);
|
uint32_t prof_time(prof_t prof);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LIBPROF_LIBPROF */
|
#endif /* LIBPROF_LIBPROF */
|
||||||
|
|
Loading…
Add table
Reference in a new issue