-
Notifications
You must be signed in to change notification settings - Fork 11
G-UTILS-GPROFILER REWORK (1): Add original files #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
granulatedekel
wants to merge
2
commits into
master
Choose a base branch
from
add-unedited-gprofiler-files-in
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or 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,2 @@ | ||
CPU_PROFILING_MODE = "cpu" | ||
DEFAULT_PROFILING_MODE = CPU_PROFILING_MODE |
This file contains hidden or 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,109 @@ | ||
# | ||
# Copyright (C) 2022 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import signal | ||
import subprocess | ||
from typing import List, Union | ||
|
||
|
||
class PerfNoSupportedEvent(Exception): | ||
pass | ||
|
||
|
||
class StopEventSetException(Exception): | ||
pass | ||
|
||
|
||
class ProcessStoppedException(Exception): | ||
pass | ||
|
||
|
||
class CalledProcessError(subprocess.CalledProcessError): | ||
# Enough characters for 200 long lines | ||
MAX_STDIO_LENGTH = 120 * 200 | ||
|
||
def __init__( | ||
self, | ||
returncode: int, | ||
cmd: Union[str, List[str]], | ||
output: str, | ||
stderr: str, | ||
): | ||
assert isinstance(returncode, int), returncode | ||
assert isinstance(cmd, str) or all(isinstance(s, str) for s in cmd), cmd | ||
assert output is None or isinstance(output, str), output | ||
assert stderr is None or isinstance(stderr, str), stderr | ||
super().__init__(returncode, cmd, output, stderr) | ||
|
||
def _truncate_stdio(self, stdio: str) -> str: | ||
if len(stdio) > self.MAX_STDIO_LENGTH: | ||
stdio = stdio[: self.MAX_STDIO_LENGTH - 3] + "..." | ||
return stdio | ||
|
||
def __str__(self) -> str: | ||
if self.returncode and self.returncode < 0: | ||
try: | ||
base = f"Command {self.cmd!r} died with {signal.Signals(-self.returncode)!r}." | ||
except ValueError: | ||
base = f"Command {self.cmd!r} died with unknown signal {-self.returncode}." | ||
else: | ||
base = f"Command {self.cmd!r} returned non-zero exit status {self.returncode}." | ||
return f"{base}\nstdout: {self._truncate_stdio(self.stdout)}\nstderr: {self._truncate_stdio(self.stderr)}" | ||
|
||
|
||
class CalledProcessTimeoutError(CalledProcessError): | ||
def __init__( | ||
self, | ||
timeout: float, | ||
returncode: int, | ||
cmd: Union[str, List[str]], | ||
output: str, | ||
stderr: str, | ||
): | ||
super().__init__(returncode, cmd, output, stderr) | ||
self.timeout = timeout | ||
|
||
def __str__(self) -> str: | ||
return f"Timed out after {self.timeout} seconds\n" + super().__str__() | ||
|
||
|
||
class ProgramMissingException(Exception): | ||
def __init__(self, program: str): | ||
super().__init__(f"The program {program!r} is missing! Please install it") | ||
|
||
|
||
class APIError(Exception): | ||
def __init__(self, message: str, full_data: dict = None): | ||
self.message = message | ||
self.full_data = full_data | ||
|
||
def __str__(self) -> str: | ||
return self.message | ||
|
||
|
||
class ThreadStopTimeoutError(Exception): | ||
pass | ||
|
||
|
||
class SystemProfilerStartFailure(Exception): | ||
pass | ||
|
||
|
||
class NoProfilersEnabledError(Exception): | ||
pass | ||
|
||
|
||
class NoRwExecDirectoryFoundError(Exception): | ||
pass | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll comment here because there's no changes in this file in the other PR.
note two things:
PerfNoSupportedEvent
for example, or am I wrong?)exceptions.py
ingranulate-utils
here, we can copy those exceptions to there. of course - this should be taken care of in a different PR (G-UTILS-GPROFILER REWORK (2): Rework complex files #261 or a new one).