Skip to content

Instantly share code, notes, and snippets.

@neontorrent
Last active January 17, 2019 02:40
Show Gist options
  • Save neontorrent/ccc4dda356226a01de673f1fea922e7c to your computer and use it in GitHub Desktop.
Save neontorrent/ccc4dda356226a01de673f1fea922e7c to your computer and use it in GitHub Desktop.
C++ Performance Tuning Notes

In order to gen call graph in perf:

-fno-omit-frame-butter

#Generate perf.data for executable perf record -g executable #0.5 is a filter?, caller is inverse the graph callstack perf report -g 'graph,0.5,caller'

Prevent optimizer to remove code:

static void escape(void *p){
  asm volatile("" : : "g"(p) : "memory");
}

static void clobber(){
  asm volatile("" : : : "memory");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment