Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EdosL0Util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SIPS
EdosL0Util
Commits
af311882
Commit
af311882
authored
9 years ago
by
Bruce Flynn
Browse files
Options
Downloads
Patches
Plain Diff
Have stream info include first, last packet
parent
6caa44a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README
+3
-0
3 additions, 0 deletions
README
edosl0util/cli.py
+2
-1
2 additions, 1 deletion
edosl0util/cli.py
edosl0util/stream.py
+15
-2
15 additions, 2 deletions
edosl0util/stream.py
with
20 additions
and
3 deletions
README
+
3
−
0
View file @
af311882
...
...
@@ -22,6 +22,9 @@ parsing use the ``PacketStream`` class as an iterator.
<Packet apid=826 seqid=13072 stamp=2015-10-13 00:22:04.042798>
>>> packets = list(stream)
>>> first, last, info = stream.info()
>>> print("First:{}\nLast:{}".format(first, last))
First:2015-10-13 00:22:04.042798
Last:2015-10-13 02:04:58.107582
>>> print info
defaultdict(<function edosl0util.stream.<lambda>>,
{800: {'count': 32351, 'last_seqid': 16043, 'num_missing': 0},
...
...
This diff is collapsed.
Click to expand it.
edosl0util/cli.py
+
2
−
1
View file @
af311882
...
...
@@ -80,9 +80,10 @@ def cmd_info():
first
=
min
(
packet
.
stamp
,
first
)
last
=
max
(
packet
.
stamp
,
last
)
total
=
0
first
,
last
,
info
=
packets
.
info
()
LOG
.
info
(
"
First: %s
"
,
first
)
LOG
.
info
(
"
Last: %s
"
,
last
)
for
apid
,
dat
in
packets
.
info
()
.
items
():
for
apid
,
dat
in
info
.
items
():
total
+=
dat
[
'
count
'
]
LOG
.
info
(
"
%d: count=%d missing=%d
"
,
apid
,
dat
[
'
count
'
],
dat
[
'
num_missing
'
])
LOG
.
info
(
"
{} total packets
"
.
format
(
total
))
...
...
This diff is collapsed.
Click to expand it.
edosl0util/stream.py
+
15
−
2
View file @
af311882
...
...
@@ -170,8 +170,12 @@ class PacketStream(object):
"""
self
.
_stream
=
jpss_full_stream
(
fobj
)
self
.
_seek_cache
=
deque
()
self
.
_first
=
None
self
.
_last
=
None
self
.
_apid_info
=
defaultdict
(
lambda
:
{
'
count
'
:
0
,
'
last_seqid
'
:
self
.
SEQID_NOTSET
,
'
num_missing
'
:
0
})
lambda
:
{
'
count
'
:
0
,
'
last_seqid
'
:
self
.
SEQID_NOTSET
,
'
num_missing
'
:
0
})
self
.
_fail_on_missing
=
fail_on_missing
def
__iter__
(
self
):
...
...
@@ -199,6 +203,15 @@ class PacketStream(object):
def
_update_info
(
self
,
packet
):
have_missing
=
False
apid
=
self
.
_apid_info
[
packet
.
apid
]
if
packet
.
stamp
:
if
self
.
_first
is
None
:
self
.
_first
=
packet
.
stamp
else
:
self
.
_first
=
min
(
packet
.
stamp
,
self
.
_first
)
if
self
.
_last
is
None
:
self
.
_last
=
packet
.
stamp
else
:
self
.
_last
=
max
(
packet
.
stamp
,
self
.
_last
)
apid
[
'
count
'
]
+=
1
if
apid
[
'
last_seqid
'
]
!=
self
.
SEQID_NOTSET
:
if
packet
.
seqid
>
apid
[
'
last_seqid
'
]:
...
...
@@ -211,7 +224,7 @@ class PacketStream(object):
return
have_missing
def
info
(
self
):
return
self
.
_apid_info
return
self
.
_first
,
self
.
_last
,
self
.
_apid_info
def
seek_to
(
self
,
stamp
,
apid
=
None
):
"""
...
...
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