Project

General

Profile

Fix #49896 » 0001-qa-verify-the-benefits-of-mempool-cacheline-optimiza.patch

Loïc Dachary, 03/19/2021 07:45 AM

View differences:

qa/standalone/c2c/c2c.sh
#!/usr/bin/env bash
source $CEPH_ROOT/qa/standalone/ceph-helpers.sh
# http://people.redhat.com/jmario/scratch/run_c2c_ceph.sh
function run_perf_c2c() {
# First get some background system info
uname -a > uname.out
lscpu > lscpu.out
cat /proc/cmdline > cmdline.out
timeout -s INT 10 vmstat -w 1 > vmstat.out
nodecnt=`lscpu|grep "NUMA node(" |awk '{print $3}'`
for ((i=0; i<$nodecnt; i++))
do
cat /sys/devices/system/node/node${i}/meminfo > meminfo.$i.out
done
more `find /proc -name status` > proc_parent_child_status.out
more /proc/*/numa_maps > numa_maps.out
#
# Get separate kernel and user perf-c2c stats
#
perf c2c record -a --ldlat=70 --all-user -o perf_c2c_a_all_user.data sleep 5
perf c2c report --stdio -i perf_c2c_a_all_user.data > perf_c2c_a_all_user.out 2>&1
perf c2c report --full-symbols --stdio -i perf_c2c_a_all_user.data > perf_c2c_full-sym_a_all_user.out 2>&1
perf c2c record -g -a --ldlat=70 --all-user -o perf_c2c_g_a_all_user.data sleep 5
perf c2c report -g --stdio -i perf_c2c_g_a_all_user.data > perf_c2c_g_a_all_user.out 2>&1
perf c2c record -a --ldlat=70 --all-kernel -o perf_c2c_a_all_kernel.data sleep 4
perf c2c report --stdio -i perf_c2c_a_all_kernel.data > perf_c2c_a_all_kernel.out 2>&1
perf c2c record -g --ldlat=70 -a --all-kernel -o perf_c2c_g_a_all_kernel.data sleep 4
perf c2c report -g --stdio -i perf_c2c_g_a_all_kernel.data > perf_c2c_g_a_all_kernel.out 2>&1
#
# Get combined kernel and user perf-c2c stats
#
perf c2c record -a --ldlat=70 -o perf_c2c_a_both.data sleep 4
perf c2c report --stdio -i perf_c2c_a_both.data > perf_c2c_a_both.out 2>&1
perf c2c record -g --ldlat=70 -a --all-kernel -o perf_c2c_g_a_both.data sleep 4
perf c2c report -g --stdio -i perf_c2c_g_a_both.data > perf_c2c_g_a_both.out 2>&1
#
# Get all-user physical addr stats, in case multiple threads or processes are
# accessing shared memory with different vaddrs.
#
perf c2c record --phys-data -a --ldlat=70 --all-user -o perf_c2c_a_all_user_phys_data.data sleep 5
perf c2c report --stdio -i perf_c2c_a_all_user_phys_data.data > perf_c2c_a_all_user_phys_data.out 2>&1
}
ceph_test_c2c &
run_perf_c2c
kill $!
qa/suites/rados/standalone/workloads/c2c.yaml
roles:
- - mon.a
- mgr.x
- osd.0
- client.0
tasks:
- install:
- workunit:
basedir: qa/standalone
clients:
all:
- c2c
src/test/CMakeLists.txt
ceph_test_stress_watch
DESTINATION ${CMAKE_INSTALL_BINDIR})
add_executable(ceph_test_c2c
test_c2c.cc
)
target_link_libraries(ceph_test_c2c
ceph-common
pthread
${EXTRALIBS}
${CMAKE_DL_LIBS}
)
if(WITH_FUSE)
add_executable(ceph_test_cfuse_cache_invalidate
test_cfuse_cache_invalidate.cc
src/test/test_c2c.cc
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "include/mempool.h"
int main(int argc, char **argv)
{
const size_t samples = mempool::num_shards * 100;
std::atomic_int shards[mempool::num_shards] = {0};
std::vector<std::thread> workers;
for (size_t i = 0; i < samples; i++) {
workers.push_back(
std::thread([&](){
size_t i = mempool::pool_t::pick_a_shard_int();
shards[i]++;
}));
}
for (auto& t:workers) {
t.join();
}
workers.clear();
return 0;
}
    (1-1/1)