-
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pmie: add -o|--format option to control output format with archives
Since most rule actions are "fake" when processing performance data from archives, the -o option provides some rudimentary control over the format of the output messages when rule actions are executed. The meta-fields supported in the -o option are (from pmie(1)) ... %a The name of the action, e.g. print, syslog, etc. %d The date and time in ctime(3) format when the action would have been executed. %f The name of the configuration file containing the action being exe‐ cuted, else <stdin> if the rules were read from standard input. %l The (approximate) line number in the configuration file for the ac‐ tion being executed. %m The message component of the action. %u The date and time when the action would have been executed in ex‐ tended ctime(3) format with microsecond precision for the time. %% A literal percent character. The default output format is equivalent to a format of %a %d: %m. Resolves #1799.
- Loading branch information
Showing
13 changed files
with
558 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/sh | ||
# PCP QA Test No. 1912 | ||
# pmie -o testing | ||
# | ||
# non-valgrind variant, see qa/1913 for the valgrind variant | ||
# | ||
# Copyright (c) 2023 Ken McDonell. All Rights Reserved. | ||
# | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
seq=`basename $0` | ||
echo "QA output created by $seq" | ||
else | ||
# use $seq from caller, unless not set | ||
[ -n "$seq" ] || seq=`basename $0` | ||
echo "QA output created by `basename $0` $*" | ||
fi | ||
|
||
# get standard environment, filters and checks | ||
. ./common.product | ||
. ./common.filter | ||
. ./common.check | ||
|
||
$sudo rm -rf $tmp $tmp.* $seq.full | ||
|
||
do_valgrind=false | ||
if [ "$1" = "--valgrind" ] | ||
then | ||
_check_valgrind | ||
do_valgrind=true | ||
elif which valgrind >/dev/null 2>&1 | ||
then | ||
[ $PCPQA_VALGRIND = both ] || \ | ||
_notrun "valgrind variant qa/1913 will be run" | ||
fi | ||
|
||
_cleanup() | ||
{ | ||
cd $here | ||
$sudo rm -rf $tmp $tmp.* | ||
} | ||
|
||
status=0 # success is the default! | ||
trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
|
||
_filter() | ||
{ | ||
sed \ | ||
-e "s@$tmp@TMP@g" \ | ||
-e '/evaluator exiting/d' \ | ||
# end | ||
} | ||
|
||
# real QA test starts here | ||
|
||
cat <<End-of-File >$tmp.config | ||
// suff at the beginning | ||
sample.wrap.long > 0 | ||
// stuff in the middle | ||
-> print "yippee %v"; | ||
// stuff at the end | ||
End-of-File | ||
|
||
# base tests ... | ||
# | ||
for fmt in "%a %d: %m" "%% %m %" "%%a=%a= %%d=%d= %%f=%f= %%l=%l= %%m=%m= %%u=%u=" \ | ||
"%m" "prologue %M epilogue" "%" | ||
do | ||
echo | ||
echo "-- $fmt --" | ||
|
||
if $do_valgrind | ||
then | ||
_run_valgrind pmie -t 2 -z -c $tmp.config -a archives/wrap -o "$fmt" | ||
else | ||
pmie -t 2 -z -c $tmp.config -a archives/wrap -o "$fmt" 2>&1 | ||
fi \ | ||
| _filter | ||
done | ||
|
||
# config on stdin, ... | ||
# | ||
echo | ||
echo "-- misc tests --" | ||
( cat $tmp.config $tmp.config ) \ | ||
| if $do_valgrind | ||
then | ||
_run_valgrind pmie -t 2 -z -a archives/wrap -o "[%f:%l] %m" | ||
else | ||
pmie -t 2 -z -a archives/wrap -o "[%f:%l] %m" 2>&1 | ||
fi \ | ||
| _filter | ||
|
||
# success, all done | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
QA output created by 1912 | ||
|
||
-- %a %d: %m -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
print Mon Dec 1 16:08:22 1997: yippee 1144454022 | ||
|
||
-- %% %m % -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
% yippee 1144454022 % | ||
|
||
-- %%a=%a= %%d=%d= %%f=%f= %%l=%l= %%m=%m= %%u=%u= -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
%a=print= %d=Mon Dec 1 16:08:22 1997= %f=TMP.config= %l=4= %m=yippee 1144454022= %u=Mon Dec 1 16:08:22.423728 1997= | ||
|
||
-- %m -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
yippee 1144454022 | ||
|
||
-- prologue %M epilogue -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
Warning: unrecognized field specifier '%M' in format | ||
prologue %M epilogue | ||
|
||
-- % -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
% | ||
|
||
-- misc tests -- | ||
pmie: timezone set to local timezone from archives/wrap | ||
[<stdin>:4] yippee 1144454022 | ||
[<stdin>:9] yippee 1144454022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
# PCP QA Test No. 1913 | ||
# pmie -o testing | ||
# | ||
# valgrind variant, see qa/1912 for the non-valgrind variant | ||
# | ||
# check-group-include: pmie | ||
# | ||
# Copyright (c) 2023 Ken McDonell. All Rights Reserved. | ||
# | ||
|
||
seq=`basename $0` | ||
echo "QA output created by $seq" | ||
|
||
# get standard environment, filters and checks | ||
. ./common.product | ||
. ./common.filter | ||
. ./common.check | ||
|
||
_check_valgrind | ||
|
||
_cleanup() | ||
{ | ||
cd $here | ||
$sudo rm -rf $tmp $tmp.* | ||
} | ||
|
||
status=0 # success is the default! | ||
$sudo rm -rf $tmp $tmp.* $seq.full | ||
trap "_cleanup; exit \$status" 0 1 2 3 15 | ||
|
||
# real QA test starts here | ||
export seq | ||
./1912 --valgrind | ||
|
||
# success, all done | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
QA output created by 1913 | ||
QA output created by 1912 --valgrind | ||
|
||
-- %a %d: %m -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
print Mon Dec 1 16:08:22 1997: yippee 1144454022 | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o %a\ %d:\ %m | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- %% %m % -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
% yippee 1144454022 % | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o %%\ %m\ % | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- %%a=%a= %%d=%d= %%f=%f= %%l=%l= %%m=%m= %%u=%u= -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
%a=print= %d=Mon Dec 1 16:08:22 1997= %f=TMP.config= %l=4= %m=yippee 1144454022= %u=Mon Dec 1 16:08:22.423728 1997= | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o %%a=%a=\ %%d=%d=\ %%f=%f=\ %%l=%l=\ %%m=%m=\ %%u=%u= | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- %m -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
yippee 1144454022 | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o %m | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- prologue %M epilogue -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
prologue %M epilogue | ||
=== std err === | ||
Warning: unrecognized field specifier '%M' in format | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o prologue\ %M\ epilogue | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- % -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
% | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -c TMP.config -a archives/wrap -o % | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... | ||
|
||
-- misc tests -- | ||
=== std out === | ||
pmie: timezone set to local timezone from archives/wrap | ||
[<stdin>:4] yippee 1144454022 | ||
[<stdin>:9] yippee 1144454022 | ||
=== std err === | ||
=== filtered valgrind report === | ||
Memcheck, a memory error detector | ||
Command: pmie -t 2 -z -a archives/wrap -o [%f:%l]\ %m | ||
LEAK SUMMARY: | ||
definitely lost: 0 bytes in 0 blocks | ||
indirectly lost: 0 bytes in 0 blocks | ||
ERROR SUMMARY: 0 errors from 0 contexts ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.