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
import os | |
import pyinotify | |
def get_current_memory_cgroup_path(): | |
try: | |
with open("/proc/self/cgroup", "r") as f: | |
for line in f: | |
parts = line.strip().split(":") | |
if len(parts) == 3 and parts[1] == "": |
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 python3 | |
import matplotlib.pyplot as plt | |
def hashsocket_1(fd): | |
return fd | |
def hashsocket_2(fd): |
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
#include <atomic> | |
#include <bits/types/clockid_t.h> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <ctime> | |
#include <cerrno> | |
#include <iostream> | |
#include <list> | |
#include <random> | |
#include <sched.h> |
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 bash | |
# Measure overhead of fsync_part_directory for SELECTs from MergeTree/ReplicatedMergeTree (due to rename under lock) | |
# Refs: https://github.com/ClickHouse/ClickHouse/pull/64955 | |
set -e | |
bin=$1 && shift | |
id=$BASHPID |
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 bash | |
# This is wrapper for faster addr2line, that is required for "perf --call-graph dwarf" | |
# NOTE: since v6.3 perf supports specifying addr2line and supports LLVM so it is not required there | |
# stdbuf is important here to avoid buffering, otherwise perf will stuck | |
stdbuf -o0 -i0 sed -e 's/,//' -e 's/^$/ffffffffffffff/' | llvm-addr2line "$@" |
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
#include <boost/smart_ptr/detail/spinlock.hpp> | |
#include <cstdint> | |
#include <cstring> | |
#include <cassert> | |
#include <iostream> | |
#include <list> | |
#include <mutex> | |
#include <optional> | |
#include <shared_mutex> | |
#include <thread> |
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
$ lscpu -J | jq '.lscpu.[] | select(.field == "Model name:").data' -r | |
AMD Ryzen Threadripper PRO 5975WX 32-Cores | |
$ musl-clang -static -O3 -o test-syscalls test-syscalls.cpp | |
$ ldd test-syscalls | |
not a dynamic executable | |
$ ./test-syscalls | |
gettid: 48735.848us, 20518777.061 cps, 48.736 ns per call | |
clock_gettime (VDSO): 20660.516us, 48401501.686 cps, 20.661 ns per call | |
nothing_indirect_call: 0.020us, 50000000000000.000 cps, 0.000 ns per call | |
nothing: 0.020us, 50000000000000.000 cps, 0.000 ns per call |
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
#include <cstdint> | |
#include <ctime> | |
#include <cerrno> | |
#include <iostream> | |
#include <utility> | |
uint64_t now_ns(clockid_t clock) | |
{ | |
struct timespec ts; | |
clock_gettime(clock, &ts); |
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
#include <cstdint> | |
#include <ctime> | |
#include <iostream> | |
#include <sys/types.h> | |
#include <thread> | |
#include <list> | |
uint64_t now_ns() | |
{ | |
struct timespec ts; |
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 python | |
# Based on https://github.com/goldshtn/linux-tracing-workshop | |
# Based on https://gist.github.com/SaveTheRbtz/807be09f73d13b80e429d45bd1707e00 | |
""" | |
The MIT License (MIT) | |
Copyright (c) 2017 Sasha Goldshtein | |
Copyright (c) 2018 Alexey Ivanov |
NewerOlder