This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: all | |
all: | |
gcc -o bottleneck main.c -pthread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package modulo | |
func fastModulo(x, n uint32) uint32 { | |
return uint32((uint64(x) * uint64(n)) >> 32) | |
} | |
func regularModulo(x, n uint32) uint32 { | |
return x % n | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"github.com/florianl/go-tc" | |
"github.com/florianl/go-tc/core" | |
"github.com/jsimonetti/rtnetlink" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bpftrace | |
/* | |
* sudo bpftrace nvidia-smi.bt -o nvidia-smi.$(date +%s%N | cut -b1-13).out | |
* | |
* Dump is limited to 64 byte as enforced by BPFTRACE_STRLEN and stack size limitations. | |
*/ | |
BEGIN | |
{ | |
printf("Tracing nvidia-smi ioctl calls ... Hit Ctrl-C to end.\n\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"os" | |
"unsafe" | |
"github.com/cilium/ebpf" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"log" | |
"os" | |
"os/signal" | |
"strconv" | |
"syscall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"github.com/cilium/ebpf" | |
"github.com/cilium/ebpf/asm" | |
"github.com/cilium/ebpf/rlimit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math/rand" | |
"time" | |
) | |
//go:noinline | |
func fibonacciRecursive(n uint32) uint32 { | |
if n < 2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bpftrace | |
/* | |
* dlopen.bt reports potential usage of dlopen() usage which is a combination | |
* of a open syscall followed by mmap syscall | |
*/ | |
BEGIN | |
{ | |
printf("Tracing potential dlopen() usage... Hit Ctrl-C to end.\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bpftrace | |
#include <linux/skbuff.h> | |
#include <linux/ip.h> | |
BEGIN | |
{ | |
printf("follow the white rabbit\n"); | |
} |
NewerOlder