Skip to content

Instantly share code, notes, and snippets.

@jchia
Created April 27, 2012 16:40
Show Gist options
  • Save jchia/2510664 to your computer and use it in GitHub Desktop.
Save jchia/2510664 to your computer and use it in GitHub Desktop.
What I learnt
git push -u origin (branch.name) # make new remote branch with current local repo
git checkout --track -b (localbranch.name) (remote)/(remotebranch.name) # checkout and track remote branch
git push (remote) :(remotebranch.name) # delete remote branch
.gitconfig: push.default=upstream # config "git push" to push only current branch
# Generate detailed ASM listing
g++ -S -fverbose-asm (source).cpp; as -alhnd (source).s > (verbose.listing).s
# oprofile incantation. It seems that bug in old version requires shutdown to get rid of some silly warning about missed samples.
oprof_start
opreport -gdf -l (library name) | op2callgrind
opcontrol --event=BR_INST_RETIRED:1000000:a:0:1 --event=LOAD_HIT_PRE:1000000 --event=MEM_LOAD_RETIRED:1000000:4:0:1 --event=RESOURCE_STALLS:1000000:4:0:1
opcontrol --start (?)
opcontrol --reset
opcontrol --stop
opcontrol --dump
opcontrol --shutdown
# Use cset to reserve cores.
sudo cset shield --cpu=0,1,2,3 --kthread=on
cset shield
sudo cset proc --set=user --exec (binary) (args...)
sudo cset shield --reset
# boost utility for simple iterator offsetting:
Function templates next() and prior()
Certain data types, such as the C++ Standard Library's forward and bidirectional iterators, do not provide addition and subtraction via operator+() or operator-(). This means that non-modifying computation of the next or prior value requires a temporary, even though operator++() or operator--() is provided. It also means that writing code like itr+1 inside a template restricts the iterator category to random access iterators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment