@@ -22,11 +22,18 @@ python_exec="python3"
22
22
install_pip=0
23
23
PYTHON_VERSION=" "
24
24
PYPERF_VERSION=" 1.11.0"
25
+ copy_dirs=" "
25
26
#
26
27
# To make sure.
27
28
#
28
29
exit_out ()
29
30
{
31
+ if [[ $to_use_pcp -eq 1 ]]; then
32
+ stop_pcp_subset
33
+ stop_pcp
34
+ shutdown_pcp
35
+ fi
36
+
30
37
echo $1
31
38
exit $2
32
39
}
@@ -111,6 +118,14 @@ generate_csv_file()
111
118
if [[ $test_name != * " WARNING:" * ]]; then
112
119
results=` echo " ${value_sum} /${res_count} " | bc -l`
113
120
printf " %s:%.2f:%s\n" $test_name $results $unit >> ${1} .csv
121
+
122
+ if [[ $to_use_pcp -eq 1 ]]; then
123
+ metric_name=" pyperf_${test_name} "
124
+ ns_results=$( $TOOLS_BIN /convert_val --from_unit $unit --to_unit ns --time_val --value $results | sed -e ' s/ns//g' )
125
+ # Cannot use convert_val directly since it does not support floating point output
126
+ sec_results=$( echo " $ns_results /1000000000" | bc -l)
127
+ result2pcp " $metric_name " " ${sec_results} "
128
+ fi
114
129
fi
115
130
reduce=0
116
131
res_count=0
@@ -129,6 +144,13 @@ generate_csv_file()
129
144
done < " ${1} .results"
130
145
results=` echo " ${value_sum} /${res_count} " | bc -l`
131
146
printf " %s:%.2f:%s\n" $test_name $results $unit >> ${1} .csv
147
+ if [[ $to_use_pcp -eq 1 ]]; then
148
+ metric_name=" pyperf_${test_name} "
149
+ ns_results=$( $TOOLS_BIN /convert_val --from_unit $unit --to_unit ns --time_val --value $results | sed -e ' s/ns//g' )
150
+ # Cannot use convert_val directly since it does not support floating point output
151
+ sec_results=$( echo " $ns_results /1000000000" | bc -l)
152
+ result2pcp " $metric_name " " ${sec_results} "
153
+ fi
132
154
}
133
155
134
156
pip3_install ()
@@ -158,10 +180,6 @@ pip3_install()
158
180
# to_home_root: home directory
159
181
# to_configuration: configuration information
160
182
# to_times_to_run: number of times to run the test
161
- # to_pbench: Run the test via pbench
162
- # to_pbench_copy: Copy the data to the pbench repository, not move_it.
163
- # to_puser: User running pbench
164
- # to_run_label: Label for the run
165
183
# to_user: User on the test system running the test
166
184
# to_sys_type: for results info, basically aws, azure or local
167
185
# to_sysname: name of the system
@@ -287,57 +305,65 @@ while [[ $# -gt 0 ]]; do
287
305
esac
288
306
done
289
307
290
- if [ $to_pbench -eq 0 ]; then
291
- PYTHON_VERSION=$( $python_exec --version | awk ' { print $2 }' )
292
- if [[ ${python_pkgs} != " " ]]; then
293
- pkg_list=` echo $python_pkgs | sed " s/,/ /g" `
294
- test_tools/package_install --packages " $python_pkgs " --no_packages $to_no_pkg_install
295
- fi
296
- if ! command -v $python_exec ; then
297
- exit_out " Error: Designated python executable, $python_exec , not present"
298
- fi
299
- pip3_install " pyperformance==$PYPERF_VERSION "
300
- pip3_install psutil
301
- pip3_install packaging
302
- pip3_install pyparsing
303
- pip3_install pyperf
304
- pip3_install toml
305
-
306
- cpus=` cat /proc/cpuinfo | grep processor | wc -l`
307
- cous=1
308
- mkdir python_results
309
-
310
- pyresults=python_results/pyperf_out_$( date " +%Y.%m.%d-%H.%M.%S" )
311
-
312
- $python_exec -m pyperformance run --output ${pyresults} .json
313
- if [ $? -ne 0 ]; then
314
- exit_out " Failed: $python_exec -m pyperformance run --output ${pyresults} .json" 1
315
- fi
316
-
317
- $python_exec -m pyperf dump ${pyresults} .json > ${pyresults} .results
318
- if [ $? -ne 0 ]; then
319
- echo " Failed: $python_exec -m pyperf dump ${pyresults} .json > ${pyresults} .results" 1
320
- echo Failed > test_results_report
321
- else
322
- echo Ran > test_results_report
323
- fi
308
+ PYTHON_VERSION=$( $python_exec --version | awk ' { print $2 }' )
309
+ if [[ ${python_pkgs} != " " ]]; then
310
+ pkg_list=` echo $python_pkgs | sed " s/,/ /g" `
311
+ test_tools/package_install --packages " $python_pkgs " --no_packages $to_no_pkg_install
312
+ fi
313
+ if ! command -v $python_exec ; then
314
+ exit_out " Error: Designated python executable, $python_exec , not present"
315
+ fi
316
+ pip3_install " pyperformance==$PYPERF_VERSION "
317
+ pip3_install psutil
318
+ pip3_install packaging
319
+ pip3_install pyparsing
320
+ pip3_install pyperf
321
+ pip3_install toml
322
+
323
+ cpus=` cat /proc/cpuinfo | grep processor | wc -l`
324
+ cous=1
325
+ mkdir python_results
326
+
327
+ pyresults=python_results/pyperf_out_$( date " +%Y.%m.%d-%H.%M.%S" )
328
+
329
+ if [[ $to_use_pcp -eq 1 ]]; then
330
+ source $TOOLS_BIN /pcp/pcp_commands.inc
331
+ setup_pcp
332
+ pcp_cfg=$TOOLS_BIN /pcp/default.cfg
333
+ pcp_dir=/tmp/pcp_pyperf_$( date " +%Y.%m.%d-%H.%M.%S" )
334
+ start_pcp $pcp_dir / pyperf $pcp_cfg
335
+ start_pcp_subset
336
+ copy_dirs=" $pcp_dir "
337
+ fi
338
+
339
+ $python_exec -m pyperformance run --output ${pyresults} .json
340
+ if [ $? -ne 0 ]; then
341
+ exit_out " Failed: $python_exec -m pyperformance run --output ${pyresults} .json" 1
342
+ fi
324
343
325
- generate_csv_file ${pyresults}
344
+ $python_exec -m pyperf dump ${pyresults} .json > ${pyresults} .results
345
+ if [ $? -ne 0 ]; then
346
+ echo " Failed: $python_exec -m pyperf dump ${pyresults} .json > ${pyresults} .results" 1
347
+ echo Failed > test_results_report
326
348
else
327
- source ~ /.bashrc
328
- arguments=" ${arguments} --test_iterations ${to_times_to_run} "
329
- cd $curdir
330
- echo $TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats
331
- $TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats
332
- if [ $? -ne 0 ]; then
333
- exit_out " Failed: $TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats "
334
- fi
335
- exit 0
349
+ echo Ran > test_results_report
336
350
fi
337
351
352
+ generate_csv_file ${pyresults}
353
+
354
+ if [[ $to_use_pcp -eq 1 ]]; then
355
+ stop_pcp_subset
356
+ stop_pcp
357
+ shutdown_pcp
358
+ fi
359
+
360
+
361
+ if [[ ! -z " $copy_dirs " ]]; then
362
+ copy_dirs=" --copy_dir $copy_dirs "
363
+ fi
338
364
339
365
#
340
366
# Process the data.
341
367
#
342
- ${curdir} /test_tools/save_results --curdir $curdir --home_root $to_home_root --results /tmp/pyperf.out --test_name pyperf --tuned_setting=$to_tuned_setting --version NONE --user $to_user --other_files " python_results/*,test_results_report"
368
+ ${curdir} /test_tools/save_results --curdir $curdir --home_root $to_home_root --results /tmp/pyperf.out --test_name pyperf --tuned_setting=$to_tuned_setting --version NONE --user $to_user --other_files " python_results/*,test_results_report" $copy_dirs
343
369
exit 0
0 commit comments