commit f6d01b7f2ceeb7a265cd9a6a07d095dba66d7d75
parent a356230bda1c8334c7ebbda5caecf3a01bb90866
Author: Andrew Laack <andrew@laack.co>
Date: Tue, 27 Oct 2026 20:35:12 -0500
Updated printouf
Diffstat:
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/perf-aware-programming/haversine/history.txt b/perf-aware-programming/haversine/history.txt
@@ -11,3 +11,18 @@ Free havs 2653
Free coords 215784
That's ~80% on parsing the json subset.
+gcc -g stub.c -lm
+./a.out artifacts/out.json
+
+---
+
+commit:
+
+Avg TS / second 2492343071
+===========================================================
+Load file TS 61239524 3.64116%
+Parse File 1516945406 90.19394%
+Free line 2235935 0.13294%
+Compute havs 100841255 5.99578%
+Free havs 380604 0.02263%
+Free coords 227904 0.01355%
diff --git a/perf-aware-programming/haversine/profile.c b/perf-aware-programming/haversine/profile.c
@@ -46,8 +46,8 @@ void addRegion(char* name, uint64_t time) {
void printRegion() {
uint ts = tsPerSecond();
- printf("\nAvg TS / second\t\t%u\n", ts);
- printf("======================================================\n");
+ printf("\nAvg TS / second\t%*u\n", 43,ts);
+ printf("===========================================================\n");
uint64_t sum = 0;
for(int i = 0; i < regionNumber; ++i) {
@@ -58,8 +58,9 @@ void printRegion() {
char* name = regions[i].name;
uint64_t time = regions[i].time;
double percentage = ((double)time / (double)sum) * 100;
- printf("%s\t\t%lld (%f\%)\n", name, time, percentage);
+ printf("%s\t\t%*lld \t%*.5f\%\n", name, 20, time, 10, percentage);
}
+ printf("\n");
}
void cleanupRegions() {