Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
dedal
Commits
e29e7d53
Commit
e29e7d53
authored
6 years ago
by
Oliver Breitwieser
Browse files
Options
Downloads
Patches
Plain Diff
Add quick awk script to parse jenkins log
Change-Id: Ic49ddb2b2200339984252266e58508de90660f0c
parent
09f4bc88
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-files/parselog.awk
+40
-0
40 additions, 0 deletions
misc-files/parselog.awk
with
40 additions
and
0 deletions
misc-files/parselog.awk
0 → 100755
+
40
−
0
View file @
e29e7d53
#!/usr/bin/awk -f
# Parses timestamp and counts seconds
# Only prints commands that took longer than a second.
function
date_to_sec
(
date
)
{
if
(
!
(
date
~
/
\[[\-
0-9
]
*T
[
:.0-9
]
*Z
\]
/
)
)
{
return
"FAIL"
}
# clear brackets from date
gsub
(
/
(\[
|
\])
/
,
""
,
date
)
date
=
sprintf
(
"(date +%%s.%%N -d '%s' || echo FAIL) 2>/dev/null"
,
date
)
date
|
getline
secs
close
(
date
)
return
secs
}
{
secs
=
date_to_sec
(
$1
)
if
(
secs
!=
"FAIL"
)
{
elapsed
=
secs
-
last
last
=
secs
if
(
elapsed
>
0
)
{
if
(
!
(
last_command
~
/^$/
))
{
# the elapsed time is for the PREVIOUS line of input
print
elapsed
last_command
}
}
$1
=
""
last_command
=
$0
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
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