mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-04-16 07:40:48 +01: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];
|
char padding[EVENT_PADDING_SIZE];
|
||||||
|
|
||||||
rb = read(fdin, &(ev->dev_idx), sizeof(int32_t));
|
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;
|
return errno;
|
||||||
|
}
|
||||||
rb = read(fdin, &padding, EVENT_PADDING_SIZE);
|
rb = read(fdin, &padding, EVENT_PADDING_SIZE);
|
||||||
if (rb < (int)sizeof(int32_t))
|
if (rb < (int)sizeof(int32_t))
|
||||||
return errno;
|
return errno;
|
||||||
@ -997,6 +1000,10 @@ inline void read_revent_recording_or_die(const char *filepath, revent_recording_
|
|||||||
fsize = get_file_size(filepath);
|
fsize = get_file_size(filepath);
|
||||||
recording->events = malloc((size_t)fsize);
|
recording->events = malloc((size_t)fsize);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
|
// Safely get file descriptor for fin, by flushing first.
|
||||||
|
fflush(fin);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = read_legacy_replay_event(fileno(fin), &recording->events[i]);
|
ret = read_legacy_replay_event(fileno(fin), &recording->events[i]);
|
||||||
if (ret == EOF) {
|
if (ret == EOF) {
|
||||||
|
@ -208,6 +208,7 @@ class ReventRecording(object):
|
|||||||
raise ValueError('Unexpected recording mode: {}'.format(self.mode))
|
raise ValueError('Unexpected recording mode: {}'.format(self.mode))
|
||||||
self.num_events, = read_struct(fh, u64_struct)
|
self.num_events, = read_struct(fh, u64_struct)
|
||||||
elif 2 > self.version >= 0:
|
elif 2 > self.version >= 0:
|
||||||
|
self.mode = GENERAL_MODE
|
||||||
self._read_devices(fh)
|
self._read_devices(fh)
|
||||||
else:
|
else:
|
||||||
raise ValueError('Invalid recording version: {}'.format(self.version))
|
raise ValueError('Invalid recording version: {}'.format(self.version))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user