Data Persistence
Raw CSV Logs
SQL Database
ParaTrac uses sqlite3 to store and retrieve trace data, which makes the trace data portable and queryable by SQL commands or APIs. There are four tables in ParaTrac trace database: env, file, proc, and syscall.
Table env
Table file stores the paths of all files that have been accessed and their mappings from iid and fid to path.
iid INTEGER, fid INTEGER, path TEXT
- iid: Instance ID of ftrace trace.
- fid: File ID.
- path: The absolute path of the file.
Table proc stores the process information traced during the application.
iid INTEGER, pid INTEGER, ppid INTEGER, live INTEGER, res INTEGER,
btime FLOAT, elapsed FLOAT, cmdline TEXT, environ TEXT
- iid: Instance ID of tracer
- pid: Process ID (not real pid, instead, hashed from pid and process time.)
- ppid: Parent process ID (not real pid, instead, hashed from ppid and process time.)
- live: The liveness of process after the tracing period. 0 is dead and 1 is live.
- res: Return value of the process exit status
- btime: Began time of the process/task
- elapsed: Elapsed time of the process/task
- cmdline: Command line that starts the process/task.
- environ: Environment variables.
Table syscall is used to store every system calls conducted during tracing time.
stamp DOUBLE, iid INTEGER, pid INTEGER, sysc INTEGER, fid INTEGER, res INTEGER,
elapsed DOUBLE, aux1 INTEGER, aux2 INTEGER
- stamp: Timestamp when the system call was called.
- iid: Instance ID of tracer, used to identify tracers. iid is used to differentiate process with the same pid but resides in different machines.
- pid: Process ID of the process who invoked the system call.
- sysc: The system call number.
- fid: The file ID.
- res: The return value of system call.
- elapsed: The elapsed time (or latency) of the system call.
- aux1: Auxiliary column 1 for multiple purposes, see below:
- If sysc is read or write, then aux1 indicates the data size requested in the system call.
- If sysc is link, then aux1 is the fid that is linked to.
- If sysc is open or close, then aux1 indicates the file size (in bytes) during the open/close time.
- aux2: Auxiliary column 2 for multiple purposes, see below:
- If sysc is read or write, then aux2 indicates the file offset (in bytes) requested in the system call.
References and Memos
Process and File Tracing
Data Plotting and Graph Drawing