Skip to content

Instantly share code, notes, and snippets.

@pavelmash
pavelmash / redefine_sqlite_syms.sh
Created March 13, 2024 11:14
mORMot sqlite3.o symbol replacer
#!/bin/sh
FILE=./x86_64-linux/sqlite3.o
objcopy --redefine-sym _pthread_mutex_trylock=pthread_mutex_trylock $FILE
objcopy --redefine-sym _pthread_mutex_destroy=pthread_mutex_destroy $FILE
objcopy --redefine-sym _pthread_create=pthread_create $FILE
objcopy --redefine-sym _pthread_mutexattr_init=pthread_mutexattr_init $FILE
objcopy --redefine-sym _pthread_mutexattr_settype=pthread_mutexattr_settype $FILE
objcopy --redefine-sym _pthread_mutex_init=pthread_mutex_init $FILE
objcopy --redefine-sym _pthread_mutexattr_destroy=pthread_mutexattr_destroy $FILE
@pavelmash
pavelmash / tfb-smoke.sh
Last active April 14, 2023 18:57
Run the same as TechEmpower test, but from console - for smoke testing
#!/usr/bin/bash
# Do the same as TechEmpower test, but from console - for smoke testing
# CORES2USE is cores, used by wrk, CORES2USE_COUNT should be equal to used cores count
# recommented method to run is.
# ./tfb-smoke.sh "server_config_namee" | tee -a results.txt
CORES2USE=6-11
CORES2USE_COUNT=6
# wrk connections count. TFB uses up to 512
CONN="-c 128"
HOST="http://localhost:8080"
@pavelmash
pavelmash / siege_emulate.sh
Last active July 24, 2022 06:40
Emulate TechEmpower VERIFY load
# This script emulate TechEmpower load during VERIFY stage
# All commands MUST ends in 20sec, otherwise verification is fail
# Expectation:
# - SIEGE 4.0.4 (https://www.joedog.org/siege-home/) to be installed; On Ubuntu: `sudo apt install siege`
# - `tfb-server` can be resolved (added to /etc/hosts for example)
# - .siegerc can be downloaded here - https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/databases/.siegerc
# Real value is 20s, if your host is fast - set lower value, 3s is ok for Ryzen5 5600
TIMEOUT="3s"
err_report() {
@pavelmash
pavelmash / visualize_tfb_res.js
Created July 20, 2022 18:39
Console utility to visualize Techempower benchmark result
// node visualize_tfb_res.js
// expect results.json to be in the same folder
const fs = require('fs')
const res = require('./results.json')
const tests = Object.keys(res.rawData).filter(tc => !tc.endsWith('Counts'))
const tf = {}
const t = {}
for (const tc of tests) {
tf[tc] = {}
t[tc] = {}
@pavelmash
pavelmash / readbtime.c
Last active December 18, 2020 09:11
Read host boot tile from /proc/stat
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int readbtime() {
FILE *fp;
char *line = NULL;
size_t len = 0;
ssize_t read;
@pavelmash
pavelmash / httpThreadAV.lpr
Created April 24, 2020 07:12
HTTP AI thread AV
program httpThreadAV;
{$I Synopse.inc}
uses
Windows,
Classes,
SynCommons,
SynCrtSock,
SynLog;
@pavelmash
pavelmash / SynDBOarAV.pas
Created January 4, 2019 18:38
Gist to reproduce a AV in SynDBOra
program SynDBOarAV;
{$I Synopse.inc} // without Synopse.inc strange compiler error on line FHttpServer.OnRequest := DoOnRequest
{$define USESYN}
uses
{.$I SynDprUses.inc} // with SynDprUses AV exists
// cmem, // with cmem AV exists
cthreads,
SynCrtSock,