-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c97dce
commit 5927716
Showing
18 changed files
with
239 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,17 @@ pkginclude_HEADERS = verrou.h synchroLib/verrouSynchroLib.h | |
|
||
PYTHON_REP=pyTools | ||
|
||
bin_SCRIPTS = ${PYTHON_REP}/verrou_dd_line ${PYTHON_REP}/verrou_dd_sym ${PYTHON_REP}/genCovBB ${PYTHON_REP}/verrou_plot_stat ${PYTHON_REP}/paraview_script.py ${PYTHON_REP}/verrou_dd_synchro ${PYTHON_REP}/post_verrou_dd ${PYTHON_REP}/verrou_dd_stdout | ||
bin_SCRIPTS = ${PYTHON_REP}/verrou_dd_line ${PYTHON_REP}/verrou_dd_sym ${PYTHON_REP}/genCovBB ${PYTHON_REP}/verrou_plot_stat ${PYTHON_REP}/paraview_script.py ${PYTHON_REP}/verrou_dd_synchro ${PYTHON_REP}/post_verrou_dd ${PYTHON_REP}/verrou_dd_stdout synchroLib/trace_verrou_synchro.py | ||
|
||
pkgpython_PYTHON = ${PYTHON_REP}/DD.py ${PYTHON_REP}/dd_config.py ${PYTHON_REP}/DD_stoch.py ${PYTHON_REP}/DD_exec_stat.py ${PYTHON_REP}/convNumLineTool.py ${PYTHON_REP}/post_config.py ${PYTHON_REP}/gen_config.py ${PYTHON_REP}/rounding_tool.py | ||
pkgpython_PYTHON = ${PYTHON_REP}/DD.py ${PYTHON_REP}/dd_config.py ${PYTHON_REP}/DD_stoch.py ${PYTHON_REP}/DD_exec_stat.py ${PYTHON_REP}/convNumLineTool.py ${PYTHON_REP}/post_config.py ${PYTHON_REP}/gen_config.py ${PYTHON_REP}/rounding_tool.py pyWrapper/verrouPyBinding.py | ||
|
||
install-exec-local: | ||
mkdir -p ${pkgpythondir} | ||
touch ${pkgpythondir}/__init__.py | ||
install -t ${prefix} -m 644 env.sh | ||
install -t ${verrouUnbuffereddir} verrouUnbuffered.so | ||
install -t ${verrouCbindingDir} verrouCBinding.so | ||
|
||
|
||
noinst_PROGRAMS = verrou-@VGCONF_ARCH_PRI@-@VGCONF_OS@ | ||
if VGCONF_HAVE_PLATFORM_SEC | ||
|
@@ -168,27 +170,6 @@ endif | |
|
||
|
||
|
||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# verrouSynchroLib-<platform>.so | ||
#---------------------------------------------------------------------------- | ||
|
||
noinst_PROGRAMS += verrouSynchroLib-@VGCONF_ARCH_PRI@-@[email protected] | ||
if VGCONF_HAVE_PLATFORM_SEC | ||
noinst_PROGRAMS += verrouSynchroLib-@VGCONF_ARCH_SEC@-@[email protected] | ||
endif | ||
|
||
VERROUSYNCHROLIB_SOURCES_COMMON = synchroLib/verrouSynchroLib.cxx | ||
|
||
verrouSynchroLib_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES = \ | ||
$(VERROUSYNCHROLIB_SOURCES_COMMON) | ||
verrouSynchroLib_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = \ | ||
$(AM_CPPFLAGS@VGCONF_PLATFORM_PRI_CAPS@) $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@) | ||
verrouSynchroLib_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \ | ||
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# vgpreload_verrou-<platform>.so | ||
#---------------------------------------------------------------------------- | ||
|
@@ -214,7 +195,7 @@ vgpreload_verrou_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = \ | |
vgpreload_verrou_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDADD = -ldl $(VERROU_LD) | ||
|
||
#---------------------------------------------------------------------------- | ||
# verrouUnbuffered-<platform>.so | ||
# verrouUnbuffered.so | ||
#---------------------------------------------------------------------------- | ||
verrouUnbuffereddir = $(pkglibdir) | ||
noinst_PROGRAMS += verrouUnbuffered.so | ||
|
@@ -224,6 +205,39 @@ VERROUUNBUFFERED_SOURCES_COMMON = unbufferPrintf.c | |
verrouUnbuffered_so_SOURCES = \ | ||
$(VERROUUNBUFFERED_SOURCES_COMMON) | ||
verrouUnbuffered_so_CPPFLAGS = \ | ||
$(subst -Wstrict-prototypes,,$(AM_CPPFLAGS@VGCONF_PLATFORM_PRI_CAPS@)) $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@) | ||
verrouUnbuffered_so_LDFLAGS = $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# verrouCBinding.so | ||
#---------------------------------------------------------------------------- | ||
verrouCbindingDir = $(pkglibdir) | ||
noinst_PROGRAMS += verrouCBinding.so | ||
|
||
|
||
VERROUCBINDING_SOURCES_COMMON = pyWrapper/verrouCBinding.c | ||
|
||
verrouCBinding_so_SOURCES = $(VERROUCBINDING_SOURCES_COMMON) | ||
verrouCBinding_so_CPPFLAGS = \ | ||
$(AM_CPPFLAGS@VGCONF_PLATFORM_PRI_CAPS@) $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@) | ||
verrouCBinding_so_LDFLAGS = $(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||
|
||
|
||
#---------------------------------------------------------------------------- | ||
# verrouSynchro.so | ||
#---------------------------------------------------------------------------- | ||
noinst_PROGRAMS += verrouSynchro.so | ||
if VGCONF_HAVE_PLATFORM_SEC | ||
noinst_PROGRAMS += verrouSynchro.so | ||
endif | ||
|
||
PRELOADSYNCHRO1 = $(subst -nodefaultlibs,,$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)) | ||
PRELOADSYNCHRO = $(subst -m64,,$(PRELOADSYNCHRO1)) | ||
|
||
VERROUSYNCHRO_SOURCES_COMMON = synchroLib/verrouSynchroLib.cxx | ||
verrouSynchro_so_SOURCES = $(VERROUSYNCHRO_SOURCES_COMMON) | ||
verrouSynchro_so_CPPFLAGS = \ | ||
$(AM_CPPFLAGS@VGCONF_PLATFORM_PRI_CAPS@) $(AM_CFLAGS_PSO_@VGCONF_PLATFORM_PRI_CAPS@) | ||
verrouUnbuffered_so_LDFLAGS = \ | ||
$(PRELOAD_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||
verrouSynchro_so_LDFLAGS = -static-libstdc++ \ | ||
$(PRELOADSYNCHRO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
//C functions to call verrou client request | ||
|
||
// start/stop instrumentation | ||
void c_verrou_start_instrumentation(void); | ||
void c_verrou_stop_instrumentation(void); | ||
|
||
void c_verrou_start_soft_instrumentation(void); | ||
void c_verrou_stop_soft_instrumentation(void); | ||
|
||
// define derteministic section | ||
void c_verrou_start_determinitic(int level); | ||
void c_verrou_stop_determinitic(int level); | ||
|
||
//dump cover | ||
unsigned int c_verrou_dump_cover(void); | ||
|
||
|
||
//counters | ||
void c_verrou_display_counters(void); | ||
unsigned int c_verrou_count_fp_instrumented(void); | ||
unsigned int c_verrou_count_fp_not_instrumented(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#!/usr/bin/python3 | ||
import sys, platform | ||
import ctypes, ctypes.util | ||
import os | ||
import os.path | ||
|
||
|
||
def searchDefaultPath(fileName): | ||
dirName=os.path.dirname(os.path.abspath(__file__)) | ||
pathPrefixTab=["./", dirName, os.path.join(dirName, "..", "lib"), | ||
os.path.join(dirName, "..", "..","..","valgrind"), | ||
os.path.join(dirName, "..", "..","..","..","libexec","valgrind"), | ||
"../" | ||
] | ||
|
||
print(pathPrefixTab, file=sys.stderr) | ||
for pathPrefix in pathPrefixTab: | ||
absPath=os.path.join(pathPrefix, fileName) | ||
if os.path.exists(absPath): | ||
# print("absPath: ", absPath,file=sys.stderr) | ||
return absPath | ||
print("FileName %s not found"%(fileName),file=sys.stderr) | ||
sys.exit(42) | ||
|
||
class bindingSynchroLib: | ||
def __init__(self, pathLib=None): | ||
if(pathLib!=None): | ||
self.lib=ctypes.CDLL(pathLib) | ||
else: | ||
self.lib=ctypes.CDLL(searchDefaultPath("verrouSynchro.so"), ctypes.RTLD_GLOBAL ) | ||
self.lib.verrou_synchro.argtypes = [ ctypes.c_char_p, ctypes.c_int] | ||
self.lib.verrou_synchro_init() | ||
def __del__(self): | ||
self.lib.verrou_synchro_finalyze() | ||
|
||
bindSynchro=bindingSynchroLib() | ||
|
||
def synchro(string, index): | ||
bindSynchro.lib.verrou_synchro(string.encode('utf-8'), index) | ||
|
||
class bindingVerrouCLib: | ||
def __init__(self, pathLib=None): | ||
if(pathLib!=None): | ||
self.lib=ctypes.CDLL(pathLib) | ||
else: | ||
self.lib=ctypes.CDLL(searchDefaultPath("verrouCBinding.so") ) | ||
|
||
self.lib.c_verrou_start_instrumentation.argtypes = [] | ||
self.lib.c_verrou_stop_instrumentation.argtypes = [] | ||
self.lib.c_verrou_start_soft_instrumentation.argtypes = [] | ||
self.lib.c_verrou_stop_soft_instrumentation.argtypes = [] | ||
self.lib.c_verrou_start_determinitic.argtypes = [ctypes.c_int] | ||
self.lib.c_verrou_stop_determinitic.argtypes = [ctypes.c_int] | ||
|
||
self.lib.c_verrou_display_counters.argtypes = [] | ||
|
||
self.lib.c_verrou_dump_cover.argtypes= [] | ||
self.lib.c_verrou_dump_cover.restype= ctypes.c_uint | ||
|
||
self.lib.c_verrou_count_fp_instrumented.argtypes= [] | ||
self.lib.c_verrou_count_fp_not_instrumented.argtypes= [] | ||
self.lib.c_verrou_count_fp_instrumented.restype= ctypes.c_uint | ||
self.lib.c_verrou_count_fp_not_instrumented.restype= ctypes.c_uint | ||
|
||
|
||
bindVerrou=bindingVerrouCLib() | ||
|
||
def start_instrumentation(): | ||
bindVerrou.lib.c_verrou_start_instrumentation() | ||
|
||
def stop_instrumentation(): | ||
bindVerrou.lib.c_verrou_stop_instrumentation() | ||
|
||
def start_soft_instrumentation(): | ||
bindVerrou.lib.c_verrou_start_soft_instrumentation() | ||
|
||
def stop_soft_instrumentation(): | ||
bindVerrou.lib.c_verrou_stop_soft_instrumentation() | ||
|
||
def start_determinitic (level): | ||
bindVerrou.lib.c_verrou_start_determinitic(level) | ||
|
||
def stop_determinitic (level): | ||
bindVerrou.lib.c_verrou_stop_determinitic(level) | ||
|
||
def dump_cover(): | ||
return bindVerrou.lib.c_verrou_dump_cover(); | ||
|
||
def display_counters(): | ||
bindVerrou.lib.c_verrou_display_counters() | ||
|
||
def count_fp_instrumented(): | ||
return bindVerrou.lib.c_verrou_count_fp_instrumented() | ||
|
||
def count_fp_not_instrumented(): | ||
return bindVerrou.lib.c_verrou_count_fp_not_instrumented() | ||
|
||
|
||
|
||
if __name__=="__main__": | ||
|
||
print("avt a binding fp: ", count_fp_instrumented()) | ||
print("avt a binding not fp: ", count_fp_not_instrumented()) | ||
a=3.*4. | ||
print(a) | ||
print("apres a binding fp: ", count_fp_instrumented()) | ||
print("apres a binding not fp: ", count_fp_not_instrumented()) | ||
|
||
|
||
synchro("toto",10) | ||
|
||
display_counters() | ||
start_instrumentation() | ||
a=3.*4 | ||
stop_instrumentation() | ||
|
||
synchro("toto",10) | ||
start_instrumentation() | ||
|
||
a*=5 | ||
stop_instrumentation() | ||
|
||
print(a) | ||
synchro("toto",10) | ||
|
Oops, something went wrong.