Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Reproducible Builds
diffoscope
Commits
0fc439ee
Commit
0fc439ee
authored
3 years ago
by
Chris Lamb
Browse files
Options
Downloads
Patches
Plain Diff
Print profile output if we were called with --profile and we were killed via TERM.
parent
d77ff3a3
No related branches found
No related tags found
No related merge requests found
Pipeline
#386913
passed
3 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diffoscope/main.py
+1
-0
1 addition, 0 deletions
diffoscope/main.py
diffoscope/profiling.py
+9
-1
9 additions, 1 deletion
diffoscope/profiling.py
with
10 additions
and
1 deletion
diffoscope/main.py
+
1
−
0
View file @
0fc439ee
...
...
@@ -728,6 +728,7 @@ def run_diffoscope(parsed_args):
def
sigterm_handler
(
signo
,
stack_frame
):
logger
.
warning
(
"
Received TERM signal; cleaning up temp files...
"
)
clean_all_temp_files
()
ProfileManager
().
finish
()
logger
.
warning
(
"
Exiting...
"
)
os
.
_exit
(
2
)
...
...
This diff is collapsed.
Click to expand it.
diffoscope/profiling.py
+
9
−
1
View file @
0fc439ee
...
...
@@ -60,9 +60,17 @@ class ProfileManager:
self
.
data
[
namespace
][
key
][
"
time
"
]
+=
time
.
time
()
-
start
self
.
data
[
namespace
][
key
][
"
count
"
]
+=
1
def
finish
(
self
,
parsed_args
):
def
finish
(
self
,
parsed_args
=
None
):
from
.presenters.utils
import
make_printer
# We are being called in the TERM handler so we don't have access to
# parsed_args. Print the profiling output to stderr if we have been
# collecting it.
if
parsed_args
is
None
:
if
_ENABLED
:
self
.
output
(
lambda
x
:
print
(
x
,
file
=
sys
.
stderr
))
return
# Include profiling in --debug output if --profile is not set.
if
parsed_args
.
profile_output
is
None
:
with
setup_logging
(
parsed_args
.
debug
,
None
)
as
logger
:
...
...
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