mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 04:21:17 +00:00
Merge pull request #306 from marcbonnici/revent_BC
Revent: Fixed backwards compatibility with v1
This commit is contained in:
commit
607187ad5b
Binary file not shown.
Binary file not shown.
11
wlauto/external/revent/revent.c
vendored
11
wlauto/external/revent/revent.c
vendored
@ -630,9 +630,12 @@ int read_legacy_replay_event(int fdin, replay_event_t* ev)
|
||||
char padding[EVENT_PADDING_SIZE];
|
||||
|
||||
rb = read(fdin, &(ev->dev_idx), sizeof(int32_t));
|
||||
if (rb < (int)sizeof(int32_t))
|
||||
if (rb < (int)sizeof(int32_t)){
|
||||
//Allow for abrupt ending of legacy recordings.
|
||||
if (!errno)
|
||||
return EOF;
|
||||
return errno;
|
||||
|
||||
}
|
||||
rb = read(fdin, &padding, EVENT_PADDING_SIZE);
|
||||
if (rb < (int)sizeof(int32_t))
|
||||
return errno;
|
||||
@ -997,6 +1000,10 @@ inline void read_revent_recording_or_die(const char *filepath, revent_recording_
|
||||
fsize = get_file_size(filepath);
|
||||
recording->events = malloc((size_t)fsize);
|
||||
i = 0;
|
||||
|
||||
// Safely get file descriptor for fin, by flushing first.
|
||||
fflush(fin);
|
||||
|
||||
while (1) {
|
||||
ret = read_legacy_replay_event(fileno(fin), &recording->events[i]);
|
||||
if (ret == EOF) {
|
||||
|
@ -208,6 +208,7 @@ class ReventRecording(object):
|
||||
raise ValueError('Unexpected recording mode: {}'.format(self.mode))
|
||||
self.num_events, = read_struct(fh, u64_struct)
|
||||
elif 2 > self.version >= 0:
|
||||
self.mode = GENERAL_MODE
|
||||
self._read_devices(fh)
|
||||
else:
|
||||
raise ValueError('Invalid recording version: {}'.format(self.version))
|
||||
|
Loading…
x
Reference in New Issue
Block a user