# megatruh/parallel-log-file-analyzer architecture

> Architecture diagram of the GitHub repository megatruh/parallel-log-file-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/megatruh/parallel-log-file-analyzer
- Repository: https://github.com/megatruh/parallel-log-file-analyzer

## Overview

This is a C log-analysis program for comparing sequential, multithreaded, and multiprocess execution. The main workflow loads a log file, dispatches analysis to the selected runner, aggregates parsed-line statistics, and reports results and timings; an optional sequential baseline verifies parallel results. The README also describes synthetic log generation and a race-condition demonstration. Edges reflect the sampled entry points, README, and source-index references; unsampled implementation details are not inferred.

Main entry points: [`app/main_final.c`](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_final.c) (Final CLI), [`app/main_bug.c`](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_bug.c) (Race demo), [`src/analyzer.c`](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/analyzer.c) (Range analyzer), [`src/thread_runner.c`](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/thread_runner.c) (Thread runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input"]
  node_generator["Log generator<br/>[gen_log.c]"]
  node_logfile["Log file"]
  node_loader["File loader<br/>[loader.c]"]
end

subgraph group_analysis["Analysis"]
  node_chunker["Line chunker<br/>[chunker.c]"]
  node_analyzer["Range analyzer<br/>[analyzer.c]"]
  node_parser["Line parser<br/>[parser.c]"]
  node_result["Result structures<br/>[common.h]"]
end

subgraph group_execution["Execution"]
  node_main["Final CLI<br/>[main_final.c]"]
  node_bugdemo["Race demo<br/>[main_bug.c]"]
  node_timer["Wall timer<br/>[timer.c]"]
  node_seq["Sequential runner<br/>[seq_runner.c]"]
  node_threads["Thread runner<br/>[thread_runner.c]"]
  node_processes["Process runner<br/>[proc_runner.c]"]
end

subgraph group_output["Reporting"]
  node_report["Result reporting<br/>[report.c]"]
end

node_user(("User"))

node_user -->|"generates logs"| node_generator
node_generator -->|"writes log"| node_logfile
node_user -->|"runs analysis"| node_main
node_user -->|"runs demo"| node_bugdemo
node_main -->|"loads file"| node_loader
node_bugdemo -->|"loads file"| node_loader
node_logfile -->|"provides input"| node_loader
node_main -->|"times work"| node_timer
node_main -->|"dispatches mode"| node_seq
node_main -->|"dispatches mode"| node_threads
node_main -->|"dispatches mode"| node_processes
node_main -->|"runs baseline"| node_seq
node_main -->|"prints results"| node_report
node_bugdemo -->|"finds boundaries"| node_chunker
node_bugdemo -->|"analyzes reference"| node_analyzer
node_bugdemo -->|"times trials"| node_timer
node_bugdemo -->|"prints banner"| node_report
node_seq -->|"processes range"| node_analyzer
node_threads -->|"splits input"| node_chunker
node_threads -->|"processes chunks"| node_analyzer
node_processes -->|"splits input"| node_chunker
node_processes -->|"processes chunks"| node_analyzer
node_analyzer -->|"parses lines"| node_parser

click node_generator "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/gen_log.c"
click node_main "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_final.c"
click node_bugdemo "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_bug.c"
click node_loader "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/loader.c"
click node_timer "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/timer.c"
click node_seq "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/seq_runner.c"
click node_threads "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/thread_runner.c"
click node_processes "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/proc_runner.c"
click node_chunker "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/chunker.c"
click node_analyzer "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/analyzer.c"
click node_parser "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/parser.c"
click node_result "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/include/common.h"
click node_report "https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/report.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_generator,node_logfile,node_loader,node_user toneBlue
class node_chunker,node_analyzer,node_parser,node_result toneAmber
class node_main,node_bugdemo,node_timer,node_seq,node_threads,node_processes toneMint
class node_report toneRose
```

## Components

### Input

- [Log generator](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/gen_log.c): `app/gen_log.c`
- **Log file**
- [File loader](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/loader.c): `src/loader.c`

### Analysis

- [Line chunker](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/chunker.c): `src/chunker.c`
- [Range analyzer](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/analyzer.c): `src/analyzer.c`
- [Line parser](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/parser.c): `src/parser.c`
- [Result structures](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/include/common.h): `include/common.h`

### Execution

- [Final CLI](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_final.c): `app/main_final.c`
- [Race demo](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/app/main_bug.c): `app/main_bug.c`
- [Wall timer](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/timer.c): `src/timer.c`
- [Sequential runner](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/seq_runner.c): `src/seq_runner.c`
- [Thread runner](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/thread_runner.c): `src/thread_runner.c`
- [Process runner](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/proc_runner.c): `src/proc_runner.c`

### Reporting

- [Result reporting](https://github.com/megatruh/parallel-log-file-analyzer/blob/main/src/report.c): `src/report.c`

### Other components

- **User**

## Connections

- User → Log generator: generates logs (evidence: `README.md`)
- Log generator → Log file: writes log (evidence: `README.md`)
- User → Final CLI: runs analysis (evidence: `README.md`)
- User → Race demo: runs demo (evidence: `README.md`)
- Final CLI → File loader: loads file (evidence: `app/main_final.c`)
- Race demo → File loader: loads file (evidence: `app/main_bug.c`)
- Log file → File loader: provides input
- Final CLI → Wall timer: times work (evidence: `app/main_final.c`)
- Final CLI → Sequential runner: dispatches mode (evidence: `app/main_final.c`)
- Final CLI → Thread runner: dispatches mode (evidence: `app/main_final.c`)
- Final CLI → Process runner: dispatches mode (evidence: `app/main_final.c`)
- Final CLI → Sequential runner: runs baseline (evidence: `app/main_final.c`)
- Final CLI → Result reporting: prints results (evidence: `app/main_final.c`)
- Race demo → Line chunker: finds boundaries (evidence: `app/main_bug.c`)
- Race demo → Range analyzer: analyzes reference (evidence: `app/main_bug.c`)
- Race demo → Wall timer: times trials (evidence: `app/main_bug.c`)
- Race demo → Result reporting: prints banner (evidence: `app/main_bug.c`)
- Sequential runner → Range analyzer: processes range (evidence: `src/seq_runner.c`)
- Thread runner → Line chunker: splits input (evidence: `src/thread_runner.c`)
- Thread runner → Range analyzer: processes chunks (evidence: `src/thread_runner.c`)
- Process runner → Line chunker: splits input (evidence: `src/proc_runner.c`)
- Process runner → Range analyzer: processes chunks (evidence: `src/proc_runner.c`)
- Range analyzer → Line parser: parses lines (evidence: `src/analyzer.c`)
