Skip to content

Instantly share code, notes, and snippets.

View ronen-fr's full-sized avatar

Ronen Friedman ronen-fr

  • Red Hat
View GitHub Profile
@ronen-fr
ronen-fr / bench1_fmt
Created February 13, 2021 16:02
fmtlib vs. strstream: (1) constructing text message from numbers and strings - google bench
float dt1 = 13.35f;
volatile int dt2 = 100;
volatile bool repair = true;
#include <sstream>
static void CondStrstr(benchmark::State& state) {
// Code before the loop is not measured
std::string x = "hello";
int c = 10;
@ronen-fr
ronen-fr / fmt2.txt
Last active February 17, 2021 06:08
fmtlib vs. strstream
 ./cmake-build-release/bench1 --benchmark_repetitions=50 --benchmark_counters_tabular=true --benchmark_report_aggregates_only=true
2021-02-14T08:00:40+02:00
Running ./cmake-build-release/bench1
Run on (8 X 4200 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x4)
L1 Instruction 32 KiB (x4)
L2 Unified 256 KiB (x4)
L3 Unified 8192 KiB (x1)
Load Average: 2.19, 3.42, 2.79
@ronen-fr
ronen-fr / store.cpp
Created February 15, 2021 10:41
disposing of a resource in the background
#define CTM std::chrono::system_clock::now().time_since_epoch()
struct ST {
explicit ST(std::string nm) : nm_{nm}
{
fmt::print("{:%H:%M:%S} ST({})}}\n", CTM, nm_);
}
std::string nm_;
@ronen-fr
ronen-fr / cephs
Last active July 3, 2021 13:46
a tool to remind me what directory I am using for what branch
sample output for the short version (cephs3.sh):
-- -- tmp/rf_sc -- -- -- diverged -- wip-ronenf-scrub-sched [887-0 us:1721-0]
6a6b4501235 osd/scrub: extracting scrub scheduling code from OSD.cc
-- -- scr6 -- -- -- -- diverged -- wip-ronenf-cscrub-be [1538-0 us:1531-0]
6624e06cd2e osd/scrub: extracting scrub scheduling code from OSD.cc
9-May 13:14 build Ninja: 3-May 17:54 build/build.ninja
@ronen-fr
ronen-fr / ceph-debug-docker
Created July 19, 2021 14:52
what I've encountered trying to run ceph-debug-docker
ronen-fr@o10:~/src/crimson_321/ceph[ronen-fr@o10 ceph]$ sudo src/script/ceph-debug-docker.sh
specify the branch [default "master:latest"]: wip-ronenf-scrub-sch-bug1
got wip-ronenf-scrub-sch-bug1==branch: wip-ronenf-scrub-sch-bug1
sha1: latest
specify the build environment [default "centos:8"]: ubuntu:focal
env: ubuntu:focal
/tmp/tmp.FXiiA3W4Qq /home/ronen-fr/src/crimson_321/ceph
@ronen-fr
ronen-fr / pulpito.py
Created August 9, 2021 14:35
querying remotes of running jobs
#!/usr/bin/python3
from bs4 import BeautifulSoup
import re
import requests
import argparse
import subprocess
import sys
import os
import pathlib
@ronen-fr
ronen-fr / order.awk
Created January 30, 2022 06:17
gawk -v PGID=21.37a7 -f order.awk < log
#!/bin/gawk
# call with the "pg of interest" as parameter, as in:
# gawk -v PGID=21.37a7 -f this-file < log
func logtm(tst)
{
gsub(/[:.]/," ",tst); split(tst,x);
return x[1]*3600 + x[2]*60 + x[3] + x[4]/1000.0
}
@ronen-fr
ronen-fr / test_scrubber_be.cc
Created February 14, 2022 12:41
question re test_scrubber_be.cc
#include <gtest/gtest.h>
#include <signal.h>
#include <stdio.h>
#include "common/async/context_pool.h"
#include "common/ceph_argparse.h"
#include "mon/MonClient.h"
#include "msg/Messenger.h"
#include "os/ObjectStore.h"
#include "osd/OSD.h"
@ronen-fr
ronen-fr / clang-format-0908
Created August 9, 2022 11:39
clang-format configuration (matching some requests)
---
Language: Cpp
BasedOnStyle: Google
AlignAfterOpenBracket: AlwaysBreak
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
#AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
@ronen-fr
ronen-fr / teu_collect.py
Created October 26, 2022 06:00
~/teu_collect_oct.py -v --logs --parse rfriedma-2022-10-22_18:19:41-rados:thrash-rf-tous1-ci-2110-distro-default-smithi 7077467
#!/usr/bin/python3
import sys
import argparse
import datetime
import subprocess
import tempfile
import os
import pathlib
import re