<commit_before>#!/bin/bash

# This requires the perf utility to be installed and the OS must be linux.
# Compile with CMAKE_BUILD_TYPE=RelWithDebInfo in the subdirectory "build".
# Run this script in the main source directory.
#
# This script sets up performance monitoring events to measure single
# document operations. Run this script with sudo when the ArangoDB
# process is already running. Then do
#   sudo perf record -e "probe_arangod:*" -aR sleep 60
# (to sample for 60 seconds). A file "perf.data" is written to the 
# current directory.
# Dump the events in this file with
#   sudo perf script
# This logs the times when individual threads hit the events.
# Remove all events with
#   sudo perf probe -d "probe_arangod:*"
# List events with
#   sudo perf probe -l

ARANGOD_EXECUTABLE=build/bin/arangod
perf probe -x $ARANGOD_EXECUTABLE -d "probe_arangod:*"

echo Adding events, this takes a few seconds...

addEvent() {
  x=$1
  y=$2
  if [ "x$y" == "x" ] ; then
    y=$x
  fi
  echo $x
  perf probe -x $ARANGOD_EXECUTABLE -a $x=$y 2> /dev/null
  perf probe -x $ARANGOD_EXECUTABLE -a ${x}Ret=$y%return 2> /dev/null
}
echo Single document operations...
addEvent insertLocal
addEvent removeLocal
addEvent modifyLocal
addEvent documentLocal

echo Single document operations on coordinator...
addEvent insertCoordinator
addEvent removeCoordinator
addEvent updateCoordinator
addEvent replaceCoordinator
addEvent documentCoordinator

echo work method in HttpServerJob
addEvent workHttpServerJob <EMAIL>

echo Done.<commit_msg>New script version.<commit_after>#!/bin/bash

# This requires the perf utility to be installed and the OS must be linux.
# Compile with CMAKE_BUILD_TYPE=RelWithDebInfo in the subdirectory "build".
# Run this script in the main source directory.
#
# This script sets up performance monitoring events to measure single
# document operations. Run this script with sudo when the ArangoDB
# process is already running. Then do
#   sudo perf record -e "probe_arangod:*" -aR sleep 60
# (to sample for 60 seconds). A file "perf.data" is written to the 
# current directory.
# Dump the events in this file with
#   sudo perf script
# This logs the times when individual threads hit the events.
# Remove all events with
#   sudo perf probe -d "probe_arangod:*"
# List events with
#   sudo perf probe -l

ARANGOD_EXECUTABLE=build/bin/arangod
perf probe -x $ARANGOD_EXECUTABLE -d "probe_arangod:*"

echo Adding events, this takes a few seconds...

addEvent() {
  x=$1
  y=$2
  if [ "x$y" == "x" ] ; then
    y=$x
  fi
  echo $x
  perf probe -x $ARANGOD_EXECUTABLE -a $x=$y 2> /dev/null
  perf probe -x $ARANGOD_EXECUTABLE -a ${x}Ret=$y%return 2> /dev/null
}
echo Single document operations...
addEvent insertLocal
addEvent removeLocal
addEvent modifyLocal
addEvent documentLocal

echo Single document operations on coordinator...
addEvent insertCoordinator
addEvent removeCoordinator
addEvent updateCoordinator
addEvent replaceCoordinator
addEvent documentCoordinator

echo work method in HttpServerJob
addEvent workHttpServerJob work@HttpServerJob.cpp

echo work method in RestDocumentHandler
addEvent executeRestReadDocument readDocument@RestDocumentHandler.cpp
addEvent executeRestInsertDocument createDocument@RestDocumentHandler.cpp
addEvent handleRequest handleRequest@HttpServer.cpp
addEvent handleWrite handleWrite@SocketTask.cpp

echo Done.
{'fraction_non_alphanumeric': 0.07214964370546319, 'fraction_numerical': 0.004750593824228029, 'mean_word_length': 4.605657237936772, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4120828', 'n_tokens_mistral': 1024, 'n_tokens_neox': 985, 'n_words': 406}