我需要确定谁提出异常来处理更好的str错误,有没有办法?
看看我的例子:
try:
os.mkdir('/valid_created_dir')
os.listdir('/invalid_path')
except OSError, msg:
# here i want i way to identify who raise the exception
if is_mkdir_who_raise_an_exception:
do some things
if is_listdir_who_raise_an_exception:
do other things ..
Run Code Online (Sandbox Code Playgroud)
我怎么能在python中处理这个?
我正在尝试找到一种方法来衡量在 ARM 平台上使用 relro 和早期绑定链接选项对启动性能的影响。
有人可以建议我如何找到使用该选项编译的二进制文件链接共享库所花费的时间?
非常感谢。
编辑 1:我的机器上没有时间信息。
root@arm:/# LD_DEBUG=统计信息/bin/date
Run Code Online (Sandbox Code Playgroud)1470: number of relocations: 90 1470: number of relocations from cache: 3 1470: number of relative relocations: 1207 Thu Jan 1 00:17:00 UTC 1970 1470: 1470: runtime linker statistics: 1470: final number of relocations: 108 1470: final number of relocations from cache: 3
我正在尝试使用cmake的功能:
CHECK_LIBRARY_EXISTS(library function location variable)
Run Code Online (Sandbox Code Playgroud)
如何检查C++库是否可用?
CHECK_LIBRARY_EXISTS(yaml-cpp "YAML::Token" ${YAML-CPP_PATHS} HAVE_YAML-CPP)
IF(HAVE_YAML-CPP)
MESSAGE(STATUS "YAML-CPP libraries founded: OK")
ENDIF(HAVE_YAML-CPP)
IF(NOT HAVE_YAML-CPP)
MESSAGE(FATAL_ERROR "ERROR: unable to link YAML::Token")
ENDIF(NOT HAVE_YAML-CPP)
Run Code Online (Sandbox Code Playgroud)
该代码片段不起作用.