diff --git a/1/exporter.py b/1/exporter.py index 0f64a94..18a3dd9 100644 --- a/1/exporter.py +++ b/1/exporter.py @@ -87,9 +87,14 @@ def write_md(procs, ordered): def draw_gantt(ordered): - out_path = os.path.join(OUT_DIR, "gantt.png") + out_tree = os.path.join(OUT_DIR, "gantt_tree.png") + out_pid = os.path.join(OUT_DIR, "gantt_pid.png") + first = min(p.start for p in ordered) + # ------------------------- + # 1) TREE ORDER (current) + # ------------------------- fig, ax = plt.subplots(figsize=(12, 6)) for i, p in enumerate(ordered): @@ -98,14 +103,34 @@ def draw_gantt(ordered): ax.set_yticks(range(len(ordered))) ax.set_yticklabels([f"{p.pid} ({p.depth})" for p in ordered]) - ax.set_xlabel("Seconds from first process start") - ax.set_title("Process Gantt (Tree + Depth)") - + ax.set_title("Gantt (Tree Order)") ax.invert_yaxis() plt.tight_layout() - plt.savefig(out_path) + plt.savefig(out_tree) + plt.close() + + # ------------------------- + # 2) PID-SORTED VIEW + # ------------------------- + pid_order = sorted(ordered, key=lambda p: p.pid) + + fig, ax = plt.subplots(figsize=(12, 6)) + + for i, p in enumerate(pid_order): + ax.barh(i, p.duration, left=p.start - first, height=0.6) + ax.text(p.start - first, i, f"PID {p.pid} ({p.depth})", va="center") + + ax.set_yticks(range(len(pid_order))) + ax.set_yticklabels([f"{p.pid} ({p.depth})" for p in pid_order]) + ax.set_xlabel("Seconds from first process start") + ax.set_title("Gantt (PID Order)") + ax.invert_yaxis() + + plt.tight_layout() + plt.savefig(out_pid) + plt.close() def main(): diff --git a/1/log.txt b/1/log.txt index e690a10..ad8b617 100644 --- a/1/log.txt +++ b/1/log.txt @@ -1,30 +1,30 @@ -PROC_START pid=44626 ppid=44625 depth=0 l=0 r=19999 ts=1777075065.157101 -PROC_START pid=44627 ppid=44626 depth=1 l=0 r=9999 ts=1777075065.157322 -PROC_START pid=44628 ppid=44626 depth=1 l=10000 r=19999 ts=1777075065.157416 -PROC_START pid=44629 ppid=44627 depth=2 l=0 r=4999 ts=1777075065.157527 -PROC_START pid=44630 ppid=44627 depth=2 l=5000 r=9999 ts=1777075065.157613 -PROC_START pid=44631 ppid=44628 depth=2 l=10000 r=14999 ts=1777075065.157635 -PROC_START pid=44633 ppid=44629 depth=3 l=0 r=2499 ts=1777075065.157754 -PROC_START pid=44632 ppid=44628 depth=2 l=15000 r=19999 ts=1777075065.157782 -PROC_START pid=44634 ppid=44630 depth=3 l=5000 r=7499 ts=1777075065.157849 -PROC_START pid=44636 ppid=44629 depth=3 l=2500 r=4999 ts=1777075065.157935 -PROC_START pid=44637 ppid=44630 depth=3 l=7500 r=9999 ts=1777075065.158011 -PROC_START pid=44635 ppid=44631 depth=3 l=10000 r=12499 ts=1777075065.158041 -PROC_START pid=44640 ppid=44632 depth=3 l=17500 r=19999 ts=1777075065.158172 -PROC_START pid=44639 ppid=44632 depth=3 l=15000 r=17499 ts=1777075065.158210 -PROC_END pid=44633 ppid=44629 depth=3 l=0 r=2499 ts=1777075065.158251 -PROC_END pid=44634 ppid=44630 depth=3 l=5000 r=7499 ts=1777075065.158348 -PROC_END pid=44636 ppid=44629 depth=3 l=2500 r=4999 ts=1777075065.158461 -PROC_END pid=44635 ppid=44631 depth=3 l=10000 r=12499 ts=1777075065.158538 -PROC_END pid=44640 ppid=44632 depth=3 l=17500 r=19999 ts=1777075065.158648 -PROC_END pid=44639 ppid=44632 depth=3 l=15000 r=17499 ts=1777075065.158726 -PROC_END pid=44629 ppid=44627 depth=2 l=0 r=4999 ts=1777075065.158737 -PROC_START pid=44638 ppid=44631 depth=3 l=12500 r=14999 ts=1777075065.158738 -PROC_END pid=44637 ppid=44630 depth=3 l=7500 r=9999 ts=1777075065.158767 -PROC_END pid=44632 ppid=44628 depth=2 l=15000 r=19999 ts=1777075065.158967 -PROC_END pid=44638 ppid=44631 depth=3 l=12500 r=14999 ts=1777075065.159187 -PROC_END pid=44631 ppid=44628 depth=2 l=10000 r=14999 ts=1777075065.159407 -PROC_END pid=44628 ppid=44626 depth=1 l=10000 r=19999 ts=1777075065.159698 -PROC_END pid=44630 ppid=44627 depth=2 l=5000 r=9999 ts=1777075065.159747 -PROC_END pid=44627 ppid=44626 depth=1 l=0 r=9999 ts=1777075065.160043 -PROC_END pid=44626 ppid=44625 depth=0 l=0 r=19999 ts=1777075065.160444 +PROC_START pid=45686 ppid=45683 depth=0 l=0 r=19999 ts=1777075170.175506 +PROC_START pid=45687 ppid=45686 depth=1 l=0 r=9999 ts=1777075170.176607 +PROC_START pid=45688 ppid=45686 depth=1 l=10000 r=19999 ts=1777075170.176646 +PROC_START pid=45690 ppid=45688 depth=2 l=10000 r=14999 ts=1777075170.177346 +PROC_START pid=45689 ppid=45687 depth=2 l=0 r=4999 ts=1777075170.177348 +PROC_START pid=45691 ppid=45687 depth=2 l=5000 r=9999 ts=1777075170.177532 +PROC_START pid=45692 ppid=45688 depth=2 l=15000 r=19999 ts=1777075170.178014 +PROC_START pid=45693 ppid=45689 depth=3 l=0 r=2499 ts=1777075170.178106 +PROC_START pid=45695 ppid=45691 depth=3 l=5000 r=7499 ts=1777075170.178382 +PROC_START pid=45698 ppid=45691 depth=3 l=7500 r=9999 ts=1777075170.178693 +PROC_START pid=45696 ppid=45689 depth=3 l=2500 r=4999 ts=1777075170.178728 +PROC_START pid=45694 ppid=45690 depth=3 l=10000 r=12499 ts=1777075170.178801 +PROC_START pid=45699 ppid=45692 depth=3 l=15000 r=17499 ts=1777075170.178864 +PROC_END pid=45693 ppid=45689 depth=3 l=0 r=2499 ts=1777075170.180091 +PROC_START pid=45697 ppid=45690 depth=3 l=12500 r=14999 ts=1777075170.180099 +PROC_END pid=45696 ppid=45689 depth=3 l=2500 r=4999 ts=1777075170.180323 +PROC_END pid=45694 ppid=45690 depth=3 l=10000 r=12499 ts=1777075170.180342 +PROC_END pid=45699 ppid=45692 depth=3 l=15000 r=17499 ts=1777075170.180396 +PROC_END pid=45698 ppid=45691 depth=3 l=7500 r=9999 ts=1777075170.180896 +PROC_START pid=45700 ppid=45692 depth=3 l=17500 r=19999 ts=1777075170.181111 +PROC_END pid=45697 ppid=45690 depth=3 l=12500 r=14999 ts=1777075170.182005 +PROC_END pid=45689 ppid=45687 depth=2 l=0 r=4999 ts=1777075170.182180 +PROC_END pid=45700 ppid=45692 depth=3 l=17500 r=19999 ts=1777075170.182464 +PROC_END pid=45690 ppid=45688 depth=2 l=10000 r=14999 ts=1777075170.182832 +PROC_END pid=45695 ppid=45691 depth=3 l=5000 r=7499 ts=1777075170.182874 +PROC_END pid=45692 ppid=45688 depth=2 l=15000 r=19999 ts=1777075170.183226 +PROC_END pid=45691 ppid=45687 depth=2 l=5000 r=9999 ts=1777075170.183675 +PROC_END pid=45688 ppid=45686 depth=1 l=10000 r=19999 ts=1777075170.184045 +PROC_END pid=45687 ppid=45686 depth=1 l=0 r=9999 ts=1777075170.184457 +PROC_END pid=45686 ppid=45683 depth=0 l=0 r=19999 ts=1777075170.185554 diff --git a/1/out/gantt_pid.png b/1/out/gantt_pid.png new file mode 100644 index 0000000..8733d39 Binary files /dev/null and b/1/out/gantt_pid.png differ diff --git a/1/out/gantt_tree.png b/1/out/gantt_tree.png new file mode 100644 index 0000000..31af6bc Binary files /dev/null and b/1/out/gantt_tree.png differ diff --git a/1/out/processes.md b/1/out/processes.md index 361a158..e6bcdb7 100644 --- a/1/out/processes.md +++ b/1/out/processes.md @@ -1,17 +1,17 @@ | PID | PPID | Depth | Start | End | Offset | Duration | |---|---|---|---|---|---|---| -| 44626 | 44625 | 0 | 1777075065.157101 | 1777075065.160444 | 0.000000 | 0.003343 | -| 44627 | 44626 | 1 | 1777075065.157322 | 1777075065.160043 | 0.000221 | 0.002721 | -| 44629 | 44627 | 2 | 1777075065.157527 | 1777075065.158737 | 0.000426 | 0.001210 | -| 44633 | 44629 | 3 | 1777075065.157754 | 1777075065.158251 | 0.000653 | 0.000497 | -| 44636 | 44629 | 3 | 1777075065.157935 | 1777075065.158461 | 0.000834 | 0.000526 | -| 44630 | 44627 | 2 | 1777075065.157613 | 1777075065.159747 | 0.000512 | 0.002134 | -| 44634 | 44630 | 3 | 1777075065.157849 | 1777075065.158348 | 0.000748 | 0.000499 | -| 44637 | 44630 | 3 | 1777075065.158011 | 1777075065.158767 | 0.000910 | 0.000756 | -| 44628 | 44626 | 1 | 1777075065.157416 | 1777075065.159698 | 0.000315 | 0.002282 | -| 44631 | 44628 | 2 | 1777075065.157635 | 1777075065.159407 | 0.000534 | 0.001772 | -| 44635 | 44631 | 3 | 1777075065.158041 | 1777075065.158538 | 0.000940 | 0.000497 | -| 44638 | 44631 | 3 | 1777075065.158738 | 1777075065.159187 | 0.001637 | 0.000449 | -| 44632 | 44628 | 2 | 1777075065.157782 | 1777075065.158967 | 0.000681 | 0.001185 | -| 44640 | 44632 | 3 | 1777075065.158172 | 1777075065.158648 | 0.001071 | 0.000476 | -| 44639 | 44632 | 3 | 1777075065.158210 | 1777075065.158726 | 0.001109 | 0.000516 | +| 45686 | 45683 | 0 | 1777075170.175506 | 1777075170.185554 | 0.000000 | 0.010048 | +| 45687 | 45686 | 1 | 1777075170.176607 | 1777075170.184457 | 0.001101 | 0.007850 | +| 45689 | 45687 | 2 | 1777075170.177348 | 1777075170.182180 | 0.001842 | 0.004832 | +| 45693 | 45689 | 3 | 1777075170.178106 | 1777075170.180091 | 0.002600 | 0.001985 | +| 45696 | 45689 | 3 | 1777075170.178728 | 1777075170.180323 | 0.003222 | 0.001595 | +| 45691 | 45687 | 2 | 1777075170.177532 | 1777075170.183675 | 0.002026 | 0.006143 | +| 45695 | 45691 | 3 | 1777075170.178382 | 1777075170.182874 | 0.002876 | 0.004492 | +| 45698 | 45691 | 3 | 1777075170.178693 | 1777075170.180896 | 0.003187 | 0.002203 | +| 45688 | 45686 | 1 | 1777075170.176646 | 1777075170.184045 | 0.001140 | 0.007399 | +| 45690 | 45688 | 2 | 1777075170.177346 | 1777075170.182832 | 0.001840 | 0.005486 | +| 45694 | 45690 | 3 | 1777075170.178801 | 1777075170.180342 | 0.003295 | 0.001541 | +| 45697 | 45690 | 3 | 1777075170.180099 | 1777075170.182005 | 0.004593 | 0.001906 | +| 45692 | 45688 | 2 | 1777075170.178014 | 1777075170.183226 | 0.002508 | 0.005212 | +| 45699 | 45692 | 3 | 1777075170.178864 | 1777075170.180396 | 0.003358 | 0.001532 | +| 45700 | 45692 | 3 | 1777075170.181111 | 1777075170.182464 | 0.005605 | 0.001353 |