Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
T
tracetools_analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
micro-ROS
ros_tracing
tracetools_analysis
Commits
f1a006e9
Commit
f1a006e9
authored
Oct 13, 2019
by
Christophe Bedard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add time difference formatting function
parent
402dc9dd
Pipeline
#88538251
failed with stage
in 45 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
tracetools_analysis/tracetools_analysis/__init__.py
tracetools_analysis/tracetools_analysis/__init__.py
+20
-2
tracetools_analysis/tracetools_analysis/convert.py
tracetools_analysis/tracetools_analysis/convert.py
+3
-1
tracetools_analysis/tracetools_analysis/process.py
tracetools_analysis/tracetools_analysis/process.py
+3
-1
No files found.
tracetools_analysis/tracetools_analysis/__init__.py
View file @
f1a006e9
...
@@ -12,5 +12,23 @@
...
@@ -12,5 +12,23 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
"""Reading and interpreting of LTTng trace data."""
"""Tools for analysing trace data."""
__author__
=
'Luetkebohle Ingo (CR/AEX3)'
def
time_diff_to_str
(
time_diff
:
float
,
)
->
str
:
"""
Format time difference as a string.
:param time_diff: the difference between two timepoints (e.g. `time.time()`)
"""
if
time_diff
<
1.0
:
# ms
return
f
'{time_diff * 1000:.0f} ms'
elif
time_diff
<
60.0
:
# s
return
f
'{time_diff:.1f} s'
else
:
# m s
return
f
'{time_diff // 60.0:.0f} m {time_diff
% 60.0
:.1f} s'
tracetools_analysis/tracetools_analysis/convert.py
View file @
f1a006e9
...
@@ -22,6 +22,8 @@ from typing import Optional
...
@@ -22,6 +22,8 @@ from typing import Optional
from
tracetools_analysis.conversion
import
ctf
from
tracetools_analysis.conversion
import
ctf
from
.
import
time_diff_to_str
DEFAULT_CONVERT_FILE_NAME
=
'converted'
DEFAULT_CONVERT_FILE_NAME
=
'converted'
...
@@ -61,7 +63,7 @@ def convert(
...
@@ -61,7 +63,7 @@ def convert(
start_time
=
time
.
time
()
start_time
=
time
.
time
()
count
=
ctf
.
convert
(
trace_directory
,
output_file_path
)
count
=
ctf
.
convert
(
trace_directory
,
output_file_path
)
time_diff
=
time
.
time
()
-
start_time
time_diff
=
time
.
time
()
-
start_time
print
(
f
'converted {count} events in {time_diff
* 1000:.2f} ms
'
)
print
(
f
'converted {count} events in {time_diff
_to_str(time_diff)}
'
)
print
(
f
'output written to: {output_file_path}'
)
print
(
f
'output written to: {output_file_path}'
)
...
...
tracetools_analysis/tracetools_analysis/process.py
View file @
f1a006e9
...
@@ -28,6 +28,8 @@ from tracetools_analysis.loading import load_file
...
@@ -28,6 +28,8 @@ from tracetools_analysis.loading import load_file
from
tracetools_analysis.processor.ros2
import
Ros2Handler
from
tracetools_analysis.processor.ros2
import
Ros2Handler
from
tracetools_read.trace
import
is_trace_directory
from
tracetools_read.trace
import
is_trace_directory
from
.
import
time_diff_to_str
def
add_args
(
parser
:
argparse
.
ArgumentParser
)
->
None
:
def
add_args
(
parser
:
argparse
.
ArgumentParser
)
->
None
:
parser
.
add_argument
(
parser
.
add_argument
(
...
@@ -136,7 +138,7 @@ def process(
...
@@ -136,7 +138,7 @@ def process(
time_diff
=
time
.
time
()
-
start_time
time_diff
=
time
.
time
()
-
start_time
ros2_handler
.
data
.
print_model
()
ros2_handler
.
data
.
print_model
()
print
(
f
'processed {len(events)} events in {time_diff
* 1000:.2f} ms
'
)
print
(
f
'processed {len(events)} events in {time_diff
_to_str(time_diff)}
'
)
def
main
():
def
main
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment