Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
open-source-case-studies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
open-source-case-studies
Commits
76bcbb97
Commit
76bcbb97
authored
2 months ago
by
Basile Desloges
Committed by
Andre Maroneze
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a possible parameter "all" for show_stats.sh
parent
658dae4c
No related branches found
No related tags found
1 merge request
!61
Add a possible parameter "all" for show_stats.sh
Pipeline
#80084
failed
2 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
show_stats.sh
+38
-7
38 additions, 7 deletions
show_stats.sh
with
38 additions
and
7 deletions
show_stats.sh
+
38
−
7
View file @
76bcbb97
#!/bin/sh -eu
#!/bin/
ba
sh -eu
if
[
$#
-lt
2
]
;
then
usage
()
{
echo
"usage:
$0
dir target1 [target2 ...]"
echo
" or:
$0
all"
exit
1
}
#if [ ( $# -lt 2 ) -o ( ( $# -eq 1 ) -a ( "$1" != "all" ) ) ]; then
if
[
$#
-lt
1
]
;
then
usage
elif
[
$#
-eq
1
]
&&
[
"
$1
"
!=
"all"
]
;
then
usage
fi
dir
=
"
$1
"
...
...
@@ -11,8 +19,31 @@ shift
# prevent issues with locale-specific numeric separators
LC_ALL
=
C
for
target
in
"
$@
"
;
do
secs
=
$(
grep
'^user_time='
$dir
/.frama-c/
$target
/stats.txt |
cut
-d
=
-f2-
)
maxmem
=
$(
grep
'^memory='
$dir
/.frama-c/
$target
/stats.txt |
cut
-d
=
-f2-
)
printf
"
$dir
/
$target
: user time %.2fs, memory %d KiB
\n
"
$secs
$maxmem
done
print_stats
()
{
local dir
target secs maxmem stats_file
dir
=
$1
target
=
$2
stats_file
=
"
$dir
/.frama-c/
$target
/stats.txt"
if
[
-f
"
$stats_file
"
]
;
then
secs
=
$(
grep
'^user_time='
"
$stats_file
"
|
cut
-d
=
-f2-
)
maxmem
=
$(
grep
'^memory='
"
$stats_file
"
|
cut
-d
=
-f2-
)
printf
"
$dir
/
$target
: user time %.2fs, memory %d KiB
\n
"
"
$secs
"
"
$maxmem
"
fi
}
if
[
"
$dir
"
=
"all"
]
;
then
SCRIPT_DIR
=
$(
cd
--
"
$(
dirname
--
"
${
BASH_SOURCE
[0]
}
"
)
"
&> /dev/null
&&
pwd
)
pushd
"
$SCRIPT_DIR
"
>
/dev/null
find
.
-type
d
-path
"./*/.frama-c/*.parse"
-o
-path
"./*/.frama-c/*.eva"
|
\
cut
-d
/
-f2
,4 |
\
sort
|
\
while
read
-r
dirtarget
;
do
IFS
=
'/'
read
-r
-a
t
<<<
"
$dirtarget
"
print_stats
"
${
t
[0]
}
"
"
${
t
[1]
}
"
done
popd
>
/dev/null
else
for
target
in
"
$@
"
;
do
print_stats
"
$dir
"
"
$target
"
done
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment