pinbin: build/opt/zsim.cpp:816: LEVEL_BASE::VOID VdsoCallPoint(LEVEL_VM::THREADID): Assertion `vdsoPatchData[tid].level' failed. Pin app terminated abnormally due to signal 6.
vDSO (virtual dynamic shared object) is a kernel machanism for exporting a carefully set kernel space routines (eg. not secret api, gettid() and gettimeofday()) to user spapce to eliminate the performance penalty of user-kernel mode switch according to wiki. vDSO
// Instrumentation function, called for EVERY instruction VOID VdsoInstrument(INS ins) { ADDRINT insAddr = INS_Address(ins); //get ins addr if (unlikely(insAddr >= vdsoStart && insAddr < vdsoEnd)) { //INS is vdso syscall if (vdsoEntryMap.find(insAddr) != vdsoEntryMap.end()) { VdsoFunc func = vdsoEntryMap[insAddr]; //call VdsoEntryPoint function //argv are: tid ,func(IARG_UINT32),arg0(LEVEL_BASE::REG_RDI),arg1(LEVEL_BASE::REG_RSI) INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoEntryPoint, IARG_THREAD_ID, IARG_UINT32, (uint32_t)func, IARG_REG_VALUE, LEVEL_BASE::REG_RDI, IARG_REG_VALUE, LEVEL_BASE::REG_RSI, IARG_END); } elseif (INS_IsCall(ins)) { //call instruction INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoCallPoint, IARG_THREAD_ID, IARG_END); } elseif (INS_IsRet(ins)) { //Ret instruction INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoRetPoint, IARG_THREAD_ID, IARG_REG_REFERENCE, LEVEL_BASE::REG_RAX /* return val */, IARG_END); } }
//Warn on the first vsyscall code translation if (unlikely(insAddr >= vsyscallStart && insAddr < vsyscallEnd && !vsyscallWarned)) { warn("Instrumenting vsyscall page code --- this process executes vsyscalls, which zsim does not virtualize!"); vsyscallWarned = true; } }
INS_Address is from pin-kit, but INS_InsertCall is pin api.
try:
.level is just show the level of nested vsyscall. I think comment the assert which trigerd when callfunc before entryfunc is just fun.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh # choose local path to install, maybe ~/.local # init = yes, will auto modified the .zshrc to add the miniconda to PATH
# If you'd prefer that conda's base environment not be activated on startup, # set the auto_activate_base parameter to false: conda config --set auto_activate_base false
you need to close all terminal(all windows in one section including all split windows), and reopen a terminal will take effect;
The double pipe (“||”) is a control operator that represents the logical OR operation. It is used to execute a command or series of commands only if the previous command or pipeline has failed or has returned a non-zero status code.
way1: Linux transparent huge page (THP) support allows the kernel to automatically promote regular memory pages into huge pages, cat /sys/kernel/mm/transparent_hugepage/enabled but achieve this needs some details.
way2: Huge pages are allocated from a reserved pool which needs to change sys-config. for example echo 20 > /proc/sys/vm/nr_hugepages. And you need to write speacial C++ code to use the hugo page
1 2 3 4
# using mmap system call to request huge page mount -t hugetlbfs \ -o uid=<value>,gid=<value>,mode=<value>,pagesize=<value>,size=<value>,\ min_size=<value>,nr_inodes=<value> none /mnt/huge
without recompile
But there is a blog using unmaintained tool hugeadm and iodlr library to do this.
Any algorithm that does random accesses into a large memory region will likely suffer from TLB misses. Examples are plenty: binary search in a big array, large hash tables, histogram-like algorithms, etc.
try: # sth except Exception as e: # 可以使用rich包 pprint.pprint(list) raise e finally: un_set()
for
间隔值
调参需要测试间隔值
1 2
for i inrange(1, 101, 3): print(i)
遍历修改值
使用 enumerate 函数结合 for 循环遍历 list,以修改 list 中的元素。
enumerate 函数返回一个包含元组的迭代器,其中每个元组包含当前遍历元素的索引和值。在 for 循环中,我们通过索引 i 修改了列表中的元素。
1 2 3 4 5
# 对于 二维list appDataDict baseline = appDataDict[0][0] # CPU Total for i, line inenumerate(appDataDict): for j, entry inenumerate(line): appDataDict[i][j] = round(entry/baseline, 7)
rows = max(len(list1), len(list2)) cols = max(len(row) for row in list1 + list2)
result = [[0] * cols for _ inrange(rows)]
for i inrange(rows): for j inrange(cols): if i < len(list1) and j < len(list1[i]): result[i][j] += list1[i][j] if i < len(list2) and j < len(list2[i]): result[i][j] += list2[i][j]
print(result)
# 将一个二维列表的所有元素除以一个数A result = [[element / A for element in row] for row in list1]
a_dict = {'color': 'blue'} for key in a_dict: print(key) # color for key in a_dict: print(key, '->', a_dict[key]) # color -> blue for item in a_dict.items(): print(item) # ('color', 'blue') for key, value in a_dict.items(): print(key, '->', value) # color -> blue
# 判断是否存在指定的键 if my_dict.get("key2") isnotNone: print("Key 'key2' exists in the dictionary.") else: print("Key 'key2' does not exist in the dictionary.")