@@ 0,0 1,32 @@
+#!/usr/bin/env Rscript
+
+library(dplyr)
+library(readr)
+library(ggplot2)
+
+one_day_ago = lubridate::now() - lubridate::ddays(6)
+one_hour_ago = lubridate::now() - lubridate::dhours(1)
+
+df <- read_tsv('track-disk-usage.tsv', col_names=c('size', 'path', 'ts')) %>%
+ filter(one_day_ago < ts) %>%
+ group_by(path) %>%
+ arrange(ts, .by_group=T) %>%
+ mutate(
+ time_ago = max(ts) - ts,
+ growth = size - min(size),
+ max_growth = max(growth) - min(growth)
+ ) %>%
+ ungroup()
+
+biggest_growers <- df %>%
+ group_by(path) %>%
+ summarize(max_growth = first(max_growth)) %>%
+ arrange(-max_growth) %>%
+ head(20)
+
+ggplot(df %>% filter(path %in% biggest_growers[["path"]])) +
+ # du reports in kibibyte, so y is in Megabytes
+ geom_step(aes(x=time_ago / lubridate::ddays(1), y=growth / 1e3)) +
+ facet_wrap("path") +
+ scale_x_reverse() +
+ labs(y = "growth (MB)", x = "days ago")
@@ 5,11 5,31 @@ LOCKFILE="$HOME/.cache/track-disk-usage.
DATAFILE="$HOME/.cache/track-disk-usage.tsv"
# Passed to sleep(1)
-LOG_INTERVAL="30m"
+LOG_INTERVAL="2h"
+
+
+# See ionice(1)
+if [ -x /usr/bin/ionice ] &&
+ /usr/bin/ionice -c3 true 2>/dev/null; then
+ IONICE="/usr/bin/ionice -c3"
+fi
+
+# See nocache(1)
+NOCACHE=
+if [ -x /usr/bin/nocache ]; then
+ NOCACHE="/usr/bin/nocache"
+fi
+
+# See nice(1)
+NICE=
+if [ -x /usr/bin/nice ]; then
+ NICE="/usr/bin/nice -n 5"
+fi
+
log_dir_sizes() {
cd "$HOME" || exit 1
- du -s \
+ $NOCACHE $NICE $IONICE du -s \
./* \
$(hidden) \
proj/* \