Commit cae10365 authored by Julius Metz's avatar Julius Metz

Initial commit

\ No newline at end of file
import as pio
def cpu_plot(values, title=None):
plot = {
'data': [],
'layout': {
'showlegend': False,
'title': {
'text': title
for cmd, cmd_data in values.items():
'type': 'scatter',
'mode': 'markers',
'x': cmd_data.get('Time', []),
'y': cmd_data.get('CPU', []),
'name': cmd,
\ No newline at end of file
import subprocess
from pathlib import Path
import time
import click
import plots_generators
'title': 'CPU load',
def parse_file(path, collectl):
process =[collectl, '-P', '-p', path, '-sZ'], capture_output=True)
output = process.stdout.decode().splitlines()
head = output.pop(0).split(' ')
head[0] = head[0][1:]
entrys_data = {}
for entry in output:
splited_entry = entry.split(' ', len(head))
cmd = splited_entry[-1]
if not cmd in entrys_data:
entrys_data[cmd] = {head_elem : [] for head_elem in head[:-1]}
for i, head_elem in enumerate(head[:-1]):
return entrys_data
@click.option('--file', '-f', required=True)
@click.option('--collectl', '-c', required=False, default='collectl')
def main(file, collectl):
path = Path(file)
if path.exists():
data = parse_file(path, collectl)
for generator, settings in CONFIG.items():
getattr(plots_generators, generator)(data, **settings)
if __name__ == '__main__':
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment