Commit 5d3ecb2f authored by lhausamm's avatar lhausamm Committed by Loic Hausammann
Browse files

Write timestamp at begining, change llu to integertime_t, change last snapshot...

Write timestamp at begining, change llu to integertime_t, change last snapshot to basename_end, still some debugging stuffs
parent 08e2317b
......@@ -5213,6 +5213,8 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
space_init_sparts(s, e->verbose);
#ifdef WITH_LOGGER
logger_log_timestamp(e->ti_old, &e->logger_time_offset,
e->logger_dump);
logger_ensure_size(e->total_nr_parts, e->logger_size);
#endif
......
......@@ -67,12 +67,15 @@ void logger_write_general_data(struct dump *d, struct logger_const *log, size_t
size_t size = 0;
if (data_type == logger_data_double)
size = sizeof(double);
else if (data_type == logger_data_longlong)
size = sizeof(long long);
else
error("Not implemented");
buff = dump_get(d, size, offset);
memcpy(buff, p, size);
*offset += size;
}
/**
......@@ -269,9 +272,12 @@ void logger_log_gpart(struct gpart *p, unsigned int mask, size_t *offset,
*offset = offset_new;
}
void logger_log_timestamp(unsigned long long int timestamp, size_t *offset,
void logger_log_timestamp(integertime_t timestamp, size_t *offset,
struct dump *dump) {
timestamp = 1000;
#ifdef SWIFT_DEBUG_CHECKS
message("writing timestamp: %llu", timestamp);
#endif
/* Start by computing the size of the message. */
const int size = logger_size(logger_mask_timestamp);
......@@ -286,7 +292,7 @@ void logger_log_timestamp(unsigned long long int timestamp, size_t *offset,
buff += 8;
/* Store the timestamp. */
memcpy(buff, &timestamp, sizeof(unsigned long long int));
memcpy(buff, &timestamp, sizeof(integertime_t));
/* Update the log message offset. */
*offset = offset_new;
......@@ -458,7 +464,7 @@ void logger_const_init(struct logger_const* log_const) {
log_const->masks_size[4] = sizeof(float);
log_const->masks_size[5] = sizeof(float);
log_const->masks_size[6] = sizeof(float) + sizeof(long long);
log_const->masks_size[7] = 8;
log_const->masks_size[7] = sizeof(integertime_t);
// todo masks_type
......
......@@ -108,6 +108,7 @@ enum logger_datatype {
logger_data_float,
logger_data_double,
logger_data_char,
logger_data_longlong,
};
/* Function prototypes. */
......@@ -116,7 +117,7 @@ void logger_log_part(struct part *p, unsigned int mask, size_t *offset,
struct dump *dump);
void logger_log_gpart(struct gpart *p, unsigned int mask, size_t *offset,
struct dump *dump);
void logger_log_timestamp(unsigned long long int t, size_t *offset,
void logger_log_timestamp(integertime_t t, size_t *offset,
struct dump *dump);
int logger_read_part(struct part *p, size_t *offset, const char *buff);
int logger_read_gpart(struct gpart *p, size_t *offset, const char *buff);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment