duration = duration_ns / NS_IN_S
if self.args.json_latencies or self.args.mongo:
- self.log_fd_event_json(pid, comm, entry, name, duration_ns, filename)
+ self.log_fd_event_json(pid, comm, entry, name, duration_ns,filename,
+ ret)
if self.is_interactive and failed and not self.args.no_color:
sys.stdout.write(FDInfo.FAILURE_RED)
if self.is_interactive and failed and not self.args.no_color:
sys.stdout.write(FDInfo.NORMAL_WHITE)
- def log_fd_event_json(self, pid, comm, entry, name, duration_ns, filename):
+ def log_fd_event_json(self, pid, comm, entry, name, duration_ns, filename,
+ ret):
if pid not in self.json_metadata:
self.json_metadata[pid] = {'pname': comm, 'fds': {}}
# Fix process name
self.json_metadata[pid]['fds'][str(fd)]['fdtype'] = fdtype
category = Syscalls.get_syscall_category(name)
- self.latencies.append({'ts_start': entry['start'],
- 'duration': duration_ns,
- 'pid': pid,
- 'category': category,
- 'fd': fd})
+ latency = {'ts_start': entry['start'],
+ 'duration': duration_ns,
+ 'pid': pid,
+ 'category': category,
+ 'fd': fd}
+
+ if ret < 0:
+ latency['errno'] = -ret
+
+ self.latencies.append(latency)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='FD syscalls analysis')