Skip to content

Instantly share code, notes, and snippets.

Disassembly of section .bpf.fn.kprobe__tcp_cleanup_rbuf:
kprobe__tcp_cleanup_rbuf:
; { // Line 87
0: 79 17 68 00 00 00 00 00 r7 = *(u64 *)(r1 + 104)
; struct sock *sk = ctx->di; int copied = ctx->si; // Line 88
1: 79 19 70 00 00 00 00 00 r9 = *(u64 *)(r1 + 112)
; u32 pid = bpf_get_current_pid_tgid() >> 32; // Line 89
2: 85 00 00 00 0e 00 00 00 call 14
3: bf 06 00 00 00 00 00 00 r6 = r0
4: b7 08 00 00 00 00 00 00 r8 = 0
--- /usr/share/bcc/tools/tcptop 2020-05-06 09:47:19.000000000 +0000
+++ my_tcptop3 2020-06-04 07:02:29.028703296 +0000
@@ -25,7 +25,7 @@
# 02-Sep-2016 Brendan Gregg Created this.
from __future__ import print_function
-from bcc import BPF
+from bcc import BPF, DEBUG_BPF, DEBUG_PREPROCESSOR, DEBUG_SOURCE
import argparse
from socket import inet_ntop, AF_INET, AF_INET6
font_family SF Mono Regular
bold_font SF Mono Bold
italic_font SF Mono Italic
bold_italic_font SF Mono Bold Italic
font_size 12.0
adjust_line_height 0
adjust_column_width 0
box_drawing_scale 0.001, 1, 1.5, 2
cursor #cccccc
cursor_text_color #111111
function my_stdlib::get_apps () >> Array[String] {
# Get all the apps running on the host
$apps = []
$facts['myenc']['myapps'].each | $range, $rval | {
$rval.each | $key, $val | {
if $key == 'appname' {
$apps = concat($apps, $val)
}
}
function my_stdlib::is_app (String $app) >> Boolean {
# Check if the host is running the specified app
$is_found = false
$facts['myapps']['myclusters'].each | $appname, $rval| {
if has_key($rval, 'name') {
if $rval['name'] == $app {
$is_found = true
# return from here
}
# ----- Trial 1 ----- #
During Minute: 1
select_class_original:
mps1 was selected by 2005 hosts
select_class_changed:
mps4 was selected by 499 hosts
mps2 was selected by 527 hosts
mps3 was selected by 482 hosts
mps1 was selected by 497 hosts
import sys
import time
import numpy as np
import json
CF_HASHTABLESIZE = 8192
def stringhash(s, seed, max):
# Implementation of StringHash() from:
# https://github.com/lpefferkorn/cfe-rsplaytime/blob/master/cfe-rsplaytime.py
diff --git a/libpromises/verify_classes.c b/libpromises/verify_classes.c
index cef489e..0cb79e6 100644
--- a/libpromises/verify_classes.c
+++ b/libpromises/verify_classes.c
@@ -161,8 +161,10 @@ static bool SelectClass(EvalContext *ctx, const Rlist *list, const Promise *pp)
assert(list);
char splay[CF_MAXVARSIZE];
+ uintmax_t now = (uintmax_t)time(NULL);
+ now -= now % CF_HASHTABLESIZE;
import sys
import time
import numpy as np
import json
CF_HASHTABLESIZE = 8192
def stringhash(s, seed, max):
# Implementation of StringHash() from:
# https://github.com/lpefferkorn/cfe-rsplaytime/blob/master/cfe-rsplaytime.py