Skip to content

Instantly share code, notes, and snippets.

% pprof --list=thread_scan a.out a.out.prof
Using local file a.out.
Using local file a.out.prof.
Removing _L_unlock_16 from all stack traces.
ROUTINE ====================== thread_scan in /afs/andrew.cmu.edu/usr9/areece/15-418/profiling/try_perf.c
199 1087 Total samples (flat / cumulative)
. . 55: size_t size;
. . 56: size_t* num_perfect_squares;
. . 57: mutex_t * num_perfect_squares_lock;
. . 58: } thread_arg_t;
Percent | Source code & Disassembly of a.out
------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 0000000000400869 <thread_scan>:
: size_t size;
: size_t* num_perfect_squares;
@awreece
awreece / small.c
Last active December 11, 2015 00:09
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
uint32_t* inarray = (uint32_t*) malloc(1ULL<<22);
size_t i;
for (i = 0; i < (1ULL<<22); i++) {
narray[i] = rand() % 50;
Program received signal SIGSEGV, Segmentation fault.
0x000000000040094d in main (argc=1, argv=0x7fffffffe088) at try_perf.c:85
85 inarray[i] = rand() % 50;
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64
(gdb) x/i $pc
=> 0x40094d <main+116>: mov %eax,(%rbx)
(gdb) x/a $rbx
0x7ffff75a9000: 0x3010102464c457f
@awreece
awreece / error
Last active December 10, 2015 16:59
$ php test.php
Fatal error: Call to a member function get_string() on a non-object in /private/tmp/test.php on line 11
require 'formula'
class Binutils < Formula
homepage 'http://www.gnu.org/software/binutils/binutils.html'
url 'http://ftpmirror.gnu.org/binutils/binutils-2.23.tar.gz'
mirror 'http://ftp.gnu.org/gnu/binutils/binutils-2.23.tar.gz'
sha1 '470c388c97ac8d216de33fa397d7be9f96c3fe04'
option 'with-libiberty', 'Compile and install libiberty'
module DJV = struct
type t = { level: int; vertex: string }
let vertex v = v.vertex
let level v = v.level
end
let _ = print_string (DJV.vertex DJV.({ level=0; vertex="hello, world\n" }))
File "temp.ml", line 4, characters 2-5:
Error: Syntax error
File "sreedhar.ml", line 30, characters 62-63:
Error: This expression has type G.V.t but an expression was expected of type
DJG.V.t
make: *** [sreedhar.cmx] Error 2
type loop_type = Self | Irreducible | Reducible | Nonheader
let analyze_loops g =
let uf = UF.init () in
let types = H.create 1337 in
let headers = H.create 1337 in
let preds = H.create 1337 in
let dfs_tree = DfsTree.create g in
let is_ancestor = DfsTree.isAncestor dfs_tree in
let compute_preds w = G.fold_pred (fun v (bp,nbp) -> if is_ancestor w v