1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

Revent: Fixed backwards compatibility with v1.

Fixed new gamemode not being set for compatibility mode.
Fixed input buffer not being flushed causing replay to fail.
Fixed infinte loop if revent recording did not end correctly.
Updated revent binaries.
This commit is contained in:
Marc Bonnici 2016-12-02 16:29:06 +00:00
parent 254e9fff38
commit b6e077c06b
4 changed files with 10 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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) {

View File

@ -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))