Skip to content

Instantly share code, notes, and snippets.

@mzcu
mzcu / unpinned.txt
Created December 18, 2022 21:23
CPU09 sched trace
This file has been truncated, but you can view the full file.
<idle>-0 [009] d.... 1125.239242: sched_switch: prev_comm=swapper/9 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=fib-slow-12 next_pid=11259 next_prio=120
fib-slow-12-11259 [009] d.... 1125.239261: sched_stat_runtime: comm=fib-slow-12 pid=11259 runtime=101830 [ns] vruntime=4050709274 [ns]
fib-slow-12-11259 [009] d.... 1125.239274: sched_switch: prev_comm=fib-slow-12 prev_pid=11259 prev_prio=120 prev_state=S ==> next_comm=swapper/9 next_pid=0 next_prio=120
fib-slow-12-11259 [009] d.... 1125.239274: sched_bandwidth: prev_comm=fib-slow-12 prev_pid=11259 prev_prio=120 prev_state=S global_runtime=94737 [us] local_runtime=0 [us]
<idle>-0 [009] d.... 1125.240421: sched_switch: prev_comm=swapper/9 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=fib-slow-42 next_pid=11289 next_prio=120
<...>-11289 [009] d.... 1125.240441: sched_stat_runtime: comm=fib-slow-42 pid=11289 runtime=44220 [ns] vruntime=4062753487 [ns]
<...>-11289 [
@mzcu
mzcu / throttling.md
Created December 13, 2022 09:59
Linux CFS throttling

Container throttling problem

Setup

  • simple program (adapted from the Internet) which calculates fibonacci sequence from multiple threads
  • fib-fast-1 thread only runs fib iterations
  • fib-slow-{2,1000} threads run fun small number of fib iterations and then sleep for 10ms
  • on exit, program reports total number of iterations/work done in all threads (throughput)
  • program is executed in a container with 1 cpu limit on a 32-core machine (unpinned vs pinned)
@mzcu
mzcu / irc-log-viewer.sh
Last active July 22, 2017 20:37
Removes join/part messages and colorizes WeeChat IRC log
# cleans up and colorizes WeeChat IRC log
# usage ./irc-log-viewer.sh path-to-irc-weechatlog
awk '!/has joined #|has quit|has left #| is now known as /\
{ date=$1 " " $2; nick=$3; $1=$2=$3=""; $0=$0; gsub(/^ /,"\t"); \
print "\x1b[31m" date "\x1b[0m \x1b[33m" nick "\x1b[0m" $0}' $1 \
| less -R -x20
@mzcu
mzcu / AddCountryCode.scpt
Created September 23, 2012 15:01
Add country code to OS X Address book entries
(*
AddCountryCode.scpt
=====================
Customization of Andreas Amann's script posted on https://discussions.apple.com/message/9169756#9169756
Description
------------