Skip to content

Instantly share code, notes, and snippets.

ahh

Block or report user

Report or block ahh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ahh
ahh / log
Created Feb 24, 2017
"fixed" RCU test
View log
Benchmark Time(ns) CPU(ns) Iterations
-----------------------------------------------------
raw time: 56.25ns
BM_RCULocked 56.6 903 100000000
raw time: 20.5ns
BM_View 20.6 329 100000000
Benchmark Time(ns) CPU(ns) Iterations
-----------------------------------------------------
raw time: 57.01ns
@ahh
ahh / log
Created Feb 24, 2017
Stack alignment results
View log
ahh@madcat % ./raw; echo $?
0
ahh@madcat % ./raw; echo $?
48
ahh@madcat % ./raw; echo $?
16
ahh@madcat % ./raw; echo $?
32
@ahh
ahh / raw.S
Created Feb 24, 2017
stack alignment detector
View raw.S
.globl _start
.section .text
_start:
movq $0x3c, %rax
movq %rsp, %rdi
andq $63, %rdi
syscall
@ahh
ahh / view.cc
Created Feb 24, 2017
Bad view benchmark with timing
View view.cc
int64_t before = rdtsc();
SpawnNThreadsRunning(15, [&shared]() {
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
});
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
@ahh
ahh / view.cc
Created Feb 24, 2017
Bad view benchmark with timing
View view.cc
int64_t before = rdtsc();
SpawnNThreadsRunning(15, [&shared]() {
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
});
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
@ahh
ahh / view.cc
Created Feb 24, 2017
Bad view benchmark
View view.cc
void BM_View(int reps) {
rcu::View<char> shared;
SpawnNThreadsRunning(15, [&shared]() {
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
});
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
@ahh
ahh / view.cc
Created Feb 24, 2017
Benchmark example
View view.cc
static rcu::View<char> shared;
void BM_View(int reps) {
for (int i = 0; i < reps; ++i) {
auto snapshot = shared.Get();
// ... do some meaningless work...
}
}
BENCHMARK(BM_View)->Threads(16);
View example.cc
for (int i = 0; i < n; ++i) {
f(x, y, z) += q;
}
You can’t perform that action at this time.