Below is the file 'src/dump_storelog.c' from this revision. You can also download the file.
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "squid.h" void usage(void) { printf("ERROR: I need the path to the swap log!\n"); exit(1); } #define NUMPERGO 1024 void parse_store_records(storeSwapLogData *s, int num) { int i; printf("read %d records\n", num); for (i = 0; i < num; i++) { #if 0 printf("Object: Op %s, lastref %d, timestamp %d, size %d, lastmod %d\n", swap_log_op_str[(int)s[i].op], (int) s[i].lastref, (int) s[i].timestamp, (int) s[i].swap_file_sz, (int) s[i].lastmod); #endif printf("%d\n", s[i].swap_file_sz); } } int main(int argc, char *argv[]) { storeSwapLogData s[NUMPERGO]; size_t ss = sizeof(s); int fd, retval; if (argc < 2) { usage(); } printf("NOTICE: opening: %s\n", argv[1]); fd = open(argv[1], O_RDONLY); if (fd < 0) { perror("open"); exit(1); } do { retval = read(fd, s, ss); if (retval <= 0) break; parse_store_records(s, retval / sizeof(storeSwapLogData)); } while (retval > 0); close(fd); exit(0); }