Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
SWIFT
SWIFTsim
Commits
b97c15d1
Commit
b97c15d1
authored
7 years ago
by
lhausamm
Committed by
Loic Hausammann
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix testlogger
parent
c14b69cc
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!502
Logger
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/logger.c
+31
-15
31 additions, 15 deletions
src/logger.c
with
31 additions
and
15 deletions
src/logger.c
+
31
−
15
View file @
b97c15d1
...
...
@@ -537,6 +537,28 @@ void logger_const_free(struct logger_const* log_const) {
free
(
log_const
->
masks_size
);
}
/**
* @brief read chunk header
*
* @param buff The reading buffer
* @param mask The mask to read
* @param offset Out: the offset pointed by this chunk (absolute)
* @param offset_cur The current chunk offset
*
* @return Number of bytes read
*/
__attribute__
((
always_inline
))
INLINE
static
int
logger_read_chunk_header
(
const
char
*
buff
,
unsigned
int
*
mask
,
size_t
*
offset
,
size_t
cur_offset
)
{
memcpy
(
mask
,
buff
,
logger_size_mask
);
buff
+=
logger_size_mask
;
*
offset
=
0
;
memcpy
(
offset
,
buff
,
logger_size_offset
);
*
offset
=
cur_offset
-
*
offset
;
return
logger_size_mask
+
logger_size_offset
;
}
/**
* @brief Read a logger message and store the data in a #part.
*
...
...
@@ -553,11 +575,9 @@ int logger_read_part(struct part *p, size_t *offset, const char *buff) {
buff
=
&
buff
[
*
offset
];
/* Start by reading the logger mask for this entry. */
uint64_t
temp
;
memcpy
(
&
temp
,
buff
,
8
);
const
int
mask
=
temp
>>
56
;
*
offset
-=
temp
&
0xffffffffffffffULL
;
buff
+=
8
;
const
size_t
cur_offset
=
*
offset
;
unsigned
int
mask
=
0
;
buff
+=
logger_read_chunk_header
(
buff
,
&
mask
,
offset
,
cur_offset
);
/* We are only interested in particle data. */
if
(
mask
&
logger_mask_timestamp
)
...
...
@@ -631,11 +651,9 @@ int logger_read_gpart(struct gpart *p, size_t *offset, const char *buff) {
buff
=
&
buff
[
*
offset
];
/* Start by reading the logger mask for this entry. */
uint64_t
temp
;
memcpy
(
&
temp
,
buff
,
8
);
const
int
mask
=
temp
>>
56
;
*
offset
-=
temp
&
0xffffffffffffffULL
;
buff
+=
8
;
const
size_t
cur_offset
=
*
offset
;
unsigned
int
mask
=
0
;
buff
+=
logger_read_chunk_header
(
buff
,
&
mask
,
offset
,
cur_offset
);
/* We are only interested in particle data. */
if
(
mask
&
logger_mask_timestamp
)
...
...
@@ -692,11 +710,9 @@ int logger_read_timestamp(unsigned long long int *t, size_t *offset,
buff
=
&
buff
[
*
offset
];
/* Start by reading the logger mask for this entry. */
uint64_t
temp
;
memcpy
(
&
temp
,
buff
,
8
);
const
int
mask
=
temp
>>
56
;
*
offset
-=
temp
&
0xffffffffffffffULL
;
buff
+=
8
;
const
size_t
cur_offset
=
*
offset
;
unsigned
int
mask
=
0
;
buff
+=
logger_read_chunk_header
(
buff
,
&
mask
,
offset
,
cur_offset
);
/* We are only interested in timestamps. */
if
(
!
(
mask
&
logger_mask_timestamp
))
...
...
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