Skip to content

Commit

Permalink
change dftracer_event_count params
Browse files Browse the repository at this point in the history
  • Loading branch information
rayandrew committed Oct 5, 2024
1 parent ecb11e0 commit 72a1019
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ The script will count number of valid events of traces

.. code-block:: bash
<install-dir>/bin/usage: dftracer_event_count [-c] [-d input_directory]
<install-dir>/bin/usage: dftracer_event_count [-f] [-d input_directory]
Arguments for this script are:

1. **-d input_directory** specify input directories. should contain .pfw or .pfw.gz files.
2. **-c** disable create index (assuming index exists, if not will throw error)
2. **-f** force index creation
3. **-h** display help
24 changes: 16 additions & 8 deletions script/dftracer_event_count
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
# The script will count number of valid events of traces
# This has the following signature.
#
# usage: dftracer_split [-c] [-d input_directory]
# usage: dftracer_split [-f] [-d input_directory]
# -d input_directory specify input directories. should contain .pfw or .pfw.gz files.
# -f override generated files
# -c disable create index (assuming index exists, if not will throw error)
# -f force index creation
# -h display help

LOG_DIR=$PWD
run_create_index=1

function usage {
echo "usage: $(basename $0) [-c] [-d input_directory]"
echo "usage: $(basename $0) [-f] [-d input_directory]"
echo " -h display help"
echo " -c disable create index (assuming index exists, if not will throw error)"
echo " -f force index creation"
echo " -d input_directory specify input directories. should contain .pfw or .pfw.gz files."
exit 1
}
while getopts ':cd:h' opt; do
while getopts ':fd:h' opt; do
case "$opt" in
c)
f)
run_create_index=0
;;
d)
Expand Down Expand Up @@ -116,8 +115,17 @@ EOF
echo $lines_count
}

files=("$LOG_DIR"/*.pfw.gz)
for file in $files; do
if [ ! -f "$file.zindex" ]; then
run_create_index=1
break
fi
done

if [ "$run_create_index" == "1" ]; then
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
$SCRIPT_DIR/dftracer_create_index -c -d $LOG_DIR -f >/dev/null
$SCRIPT_DIR/dftracer_create_index -f -d $LOG_DIR -f >/dev/null
fi

get_lines_count $LOG_DIR
4 changes: 2 additions & 2 deletions script/dftracer_split
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ rm -f *.pfw

LINES_COUNT=$(
{
$SCRIPT_DIR/dftracer_event_count -d $LOG_DIR -c
$SCRIPT_DIR/dftracer_event_count -d $LOG_DIR
} &)
SPLIT_LINES_COUNT=$(
{
$SCRIPT_DIR/dftracer_event_count -d $dest -c
$SCRIPT_DIR/dftracer_event_count -d $dest
} &)
wait

Expand Down

0 comments on commit 72a1019

Please sign in to comment.