Posts

Showing posts with the label profiling

perf report shows this function “__memset_avx2_unaligned_erms” has overhead. does this mean memory is unaligned?

Image
Clash Royale CLAN TAG #URR8PPP perf report shows this function “__memset_avx2_unaligned_erms” has overhead. does this mean memory is unaligned? I am trying to profile my C++ code using perf tool. Implementation contains code with SSE/AVX/AVX2 instructions. In addition to that code is compiled with -O3 -mavx2 -march=native flags. I believe __memset_avx2_unaligned_erms function is a libc implementation of memset . perf shows that this function has considerable overhead. Function name indicates that memory is unaligned, however in the code I am explicitly aligning the memory using GCC built-in macro __attribute__((aligned (x))) What might be the reason for this function to have significant overhead and also why unaligned version is called although memory is aligned explicitly? -O3 -mavx2 -march=native __memset_avx2_unaligned_erms memset __attribute__((aligned (x))) I have attached the sample report as picture. memset happens to be implemented in a way that d...

saving cProfile results to readable external file

Image
Clash Royale CLAN TAG #URR8PPP saving cProfile results to readable external file I am using cProfile try to profile my codes: cProfile pr = cProfile.Profile() pr.enable() my_func() # the code I want to profile pr.disable() pr.print_stats() However, the results are too long and cannot be fully displayed in the Spyder terminal (the function calls which take the longest time to run cannot be seen...). I also tried saving the results using cProfile.run('my_func()','profile_results') , but the output file is not in human readable format (tried with and without .txt suffix). cProfile.run('my_func()','profile_results') .txt So my question is how can I save the profiling results to an external file which is human readable (like in a .txt format with all the words properly displayed)? Basically cProfile output is a binary file. Why you can't use dump_stats + pstats.Stats ? – Danila Ganchar 1...