Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
7f9436fd
Commit
7f9436fd
authored
Mar 10, 2019
by
Loic Hausammann
Browse files
logger: 2nd meeting
parent
22ba5b23
Changes
5
Hide whitespace changes
Inline
Side-by-side
logger/logger_dump.h
View file @
7f9436fd
...
...
@@ -29,10 +29,12 @@ struct logger_reader;
/**
* @brief This structure deals with the dump file.
*
* TODO
*/
struct
logger_dump
{
/* Information contained in the header. */
/* Information contained in the
file
header. */
struct
header
header
;
/* The reader that is using this dump. */
...
...
@@ -41,9 +43,6 @@ struct logger_dump {
/* Information about the time chunks */
struct
time_array
times
;
/* Dump's filename */
char
*
filename
;
/* The dump's variables. */
struct
{
/* Mapped data */
...
...
logger/logger_header.c
View file @
7f9436fd
...
...
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
/*
Task
type names. */
/*
Offset
type names. */
const
char
*
logger_offset_name
[
logger_offset_count
]
=
{
"Forward"
,
"Backward"
,
"Corrupted"
,
};
...
...
logger/logger_io.c
View file @
7f9436fd
...
...
@@ -29,14 +29,14 @@
* @brief get the size of a file
*
* @param fd file id
* @param size out: file size
*
* @return file size
*/
void
io_get_file_size
(
int
fd
,
size_t
*
size
)
{
size_t
io_get_file_size
(
int
fd
)
{
struct
stat
s
;
int
status
=
fstat
(
fd
,
&
s
);
if
(
status
!=
0
)
error
(
"Unable to get file size (%s)"
,
strerror
(
errno
));
*
size
=
s
.
st_size
;
return
s
.
st_size
;
}
/**
...
...
@@ -55,8 +55,7 @@ void *io_mmap_file(char *filename, size_t *file_size) {
error
(
"Unable to open file %s (%s)"
,
filename
,
strerror
(
errno
));
/* get file size */
*
file_size
=
0
;
io_get_file_size
(
fd
,
file_size
);
*
file_size
=
io_get_file_size
(
fd
);
/* map memory */
void
*
map
=
mmap
(
NULL
,
*
file_size
,
PROT_WRITE
|
PROT_READ
,
MAP_SHARED
,
fd
,
0
);
...
...
logger/logger_io.h
View file @
7f9436fd
...
...
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
void
io_get_file_size
(
int
fd
,
size_t
*
size
);
size_t
io_get_file_size
(
int
fd
);
void
*
io_mmap_file
(
char
*
filename
,
size_t
*
file_size
);
void
io_munmap_file
(
void
*
map
,
size_t
file_size
);
...
...
logger/logger_python_wrapper.c
View file @
7f9436fd
...
...
@@ -75,7 +75,6 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
}
/* initialize the reader */
verbose
=
2
;
struct
logger_reader
reader
;
logger_reader_init
(
&
reader
,
filename
,
verbose
);
struct
header
*
h
=
&
reader
.
dump
.
header
;
...
...
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