Skip to contentSkip to conversation

statplot: a tool for mining repository statistics.

PATCH/RFC Shawn O. Pearce 4 participants 6 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is a simple program to dump statistics about number of objects per day, and how much disk space is used per day. It can be used to generate data files suitable for plotting repository growth over time.

This program avoids displaying information about tags, but it does cover the commits referenced by those tags. Since annotated tags are a very small portion of most projects I don't consider this to be a major issue at this time.

---

This is on top of Nico's cleanups that are currently in next, as I'm using the newer read_sha1_file interface. Otherwise it has no dependencies on stuff in next.

I am normally very anti-self-linking, but I have posted graphs from git.git and linux-2.6.git on my website if people are interested, so I'm self-linking:

http://www.spearce.org/2007/03/git-and-linux-repository-growth.html

I figured a link in email would be better than an attachment. ;-)

This is a toy, but its more than good enough for production, so uh, here it is. Should it be included in git.git? Don't know....

 .gitignore                     |    1 +
 Documentation/git-statplot.txt |   63 ++++++++
 Makefile                       |    1 +
 builtin-statplot.c             |  318 ++++++++++++++++++++++++++++++++++++++++
 builtin.h                      |    1 +
 git.c                          |    1 +
 6 files changed, 385 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-statplot.txt
 create mode 100644 builtin-statplot.c
.gitignore +1 -0
index 0eaba0a..4c73efb 100644
@@ -119,6 +119,7 @@ git-ssh-fetch
 git-ssh-pull
 git-ssh-push
 git-ssh-upload
+git-statplot
 git-status
 git-stripspace
 git-svn
Documentation/git-statplot.txt new file +63 -0

63 lines not on this page · raw message

Makefile +1 -0
index e4bb865..83da7fd 100644
@@ -317,6 +317,7 @@ BUILTIN_OBJS = \
 	builtin-runstatus.o \
 	builtin-shortlog.o \
 	builtin-show-branch.o \
+	builtin-statplot.o \
 	builtin-stripspace.o \
 	builtin-symbolic-ref.o \
 	builtin-tar-tree.o \
builtin-statplot.c new file +318 -0

318 lines not on this page · raw message

builtin.h +1 -0
index 48d68c8..8a6ee95 100644
@@ -66,6 +66,7 @@ extern int cmd_runstatus(int argc, const char **argv, const char *prefix);
 extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
 extern int cmd_show(int argc, const char **argv, const char *prefix);
 extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
+extern int cmd_statplot(int argc, const char **argv, const char *prefix);
 extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
 extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
git.c +1 -0
index 008e016..994f22e 100644
@@ -278,6 +278,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
 		{ "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
 		{ "show-branch", cmd_show_branch, RUN_SETUP },
 		{ "show", cmd_show, RUN_SETUP | USE_PAGER },
+		{ "statplot", cmd_statplot, RUN_SETUP },
 		{ "stripspace", cmd_stripspace },
 		{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
 		{ "tar-tree", cmd_tar_tree },
Signature · 1 line
1.5.0.2.809.g0f936
#1 lore raw
Quoted 10 lines · Shawn O. Pearce

This is a simple program to dump statistics about number of objects per day, and how much disk space is used per day. It can be used to generate data files suitable for plotting repository growth over time.

This program avoids displaying information about tags, but it does cover the commits referenced by those tags. Since annotated tags are a very small portion of most projects I don't consider this to be a major issue at this time.

Tried it on my repo but the program produced some records with all zeros. I.e.:
2005-11-10 6 222 235 463 1785888
2005-11-11 3 34 2 39 9729
2005-11-12 0 0 0 0 0
2005-11-13 0 0 0 0 0
2005-11-14 6 227 330 563 716230
2005-11-15 3 121 209 333 1162839

What could this possibly mean?

Quoted 3 lines

This is a toy, but its more than good enough for production, so uh, here it is. Should it be included in git.git? Don't know....

Definitely! It's interesting, and fun.

#2 lore raw
Quoted 10 lines · Alex Riesen

Tried it on my repo but the program produced some records with all zeros. I.e.:
2005-11-10 6 222 235 463 1785888
2005-11-11 3 34 2 39 9729
2005-11-12 0 0 0 0 0
2005-11-13 0 0 0 0 0
2005-11-14 6 227 330 563 716230
2005-11-15 3 121 209 333 1162839

What could this possibly mean?

There were no new objects attributed to 12 and 13 of Nov, 2005. The program allocates a zero'd array for every day in the entire range, then increments each day with the number of objects introduced by commit(s) on that day. It then just prints the entire array, rather than only printing the non-zero lines. ;-)

Horribly simple code. Maybe too dumb for inclusion in git.git.

Signature · 1 line
Shawn.
#3 lore raw
Quoted 9 lines · Shawn O. Pearce
Quoted 9 lines

Tried it on my repo but the program produced some records with all zeros. I.e.:
2005-11-10 6 222 235 463 1785888
2005-11-11 3 34 2 39 9729
2005-11-12 0 0 0 0 0
2005-11-13 0 0 0 0 0
2005-11-14 6 227 330 563 716230
2005-11-15 3 121 209 333 1162839

Quoted 7 lines
Quoted 1 line

What could this possibly mean?

There were no new objects attributed to 12 and 13 of Nov, 2005. The program allocates a zero'd array for every day in the entire range, then increments each day with the number of objects introduced by commit(s) on that day. It then just prints the entire array, rather than only printing the non-zero lines. ;-)

oh, ok.

Quoted 1 line

Horribly simple code. Maybe too dumb for inclusion in git.git.

I still think it's good for something (I used it to quickly find days for weekly and monthly report).

#4 lore raw
In reply to Shawn O. Pearce
Quoted 1 line · Shawn O. Pearce

Horribly simple code.  Maybe too dumb for inclusion in git.git.

Perhaps it would be better to include it (first) in contrib/ section, then? It looks more like contrib, by the way, than something than should be in git.git core...

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#5 lore raw

Hi,

Quoted 7 lines · Jakub Narebski
Quoted 1 line · Shawn O. Pearce

Horribly simple code.  Maybe too dumb for inclusion in git.git.

Perhaps it would be better to include it (first) in contrib/ section, then? It looks more like contrib, by the way, than something than should be in git.git core...

It depends not only on libgit.a, but also on being a builtin. I actually _like_ writing builtins better than non-builtins, since the infrastructure is so simple.

If now only a unified option parser would appear out of the void, that'd be perfect.

Ciao,
Dscho