Skip to content

Instantly share code, notes, and snippets.

@arrogantrabbit
Last active April 20, 2023 05:25
Show Gist options
  • Save arrogantrabbit/94440aff1fdb4afeb659aae0ffb169da to your computer and use it in GitHub Desktop.
Save arrogantrabbit/94440aff1fdb4afeb659aae0ffb169da to your computer and use it in GitHub Desktop.
STORJ: repeated downloads
bzgrep "download started" storj* | sed -E 's/.*Piece ID\": \"([^\"]+)".*/\1/' | sort | uniq -c | awk '
BEGIN {
split("1, 10, 100, 1000, 10000", thresholds, ",");
print("Collecting the counts for thresholds\n");
} {
count_now=$1;
for (i in thresholds) {
if (count_now > thresholds[i])
counts[i] += count_now
}
totals += count_now;
} END {
printf("Download was requested for %d total chunks\n", totals);
for (i in thresholds)
printf("%3.2f%% of chunks were requested more than %d times\n", counts[i]/totals*100, thresholds[i]);
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment