Skip to content

Instantly share code, notes, and snippets.

View ReidAtcheson's full-sized avatar

Reid Atcheson ReidAtcheson

View GitHub Profile
@ReidAtcheson
ReidAtcheson / commands.md
Created November 2, 2023 21:05
gather two performance counters, split them into two stack files, and then combine into a new metric

sample as long as you want, ctrl-C when you've had enough can also --call-graph dwarf for more accurate stack traces but will take a lot more memory & storage

sudo perf record -e cycles,instructions -c 1000000 -a --call-graph fp

get the stacks

sudo perf script > stacks.out
@ReidAtcheson
ReidAtcheson / why.cpp
Created March 12, 2023 21:02
why alloc
#include <memory_resource>
int main(int argc,char** argv){
void* buffer;
std::pmr::monotonic_buffer_resource resource(buffer,8,std::pmr::null_memory_resource());
// When Above commented out:
//
//valgrind ./a.out
//==68433== HEAP SUMMARY:
//==68433== in use at exit: 0 bytes in 0 blocks

Keybase proof

I hereby claim:

  • I am reidatcheson on github.
  • I am reidatcheson (https://keybase.io/reidatcheson) on keybase.
  • I have a public key ASAhddl6cGir4yt4i2aqq9WV-glJ_WzpIbY-ddRC3ouf8Qo

To claim this, I am signing this object: