wiki:Developer/CodeSwarm

Version 2 (modified by JoelSherrill, on Mar 17, 2009 at 6:41:06 PM) (diff)

Add thank you

RTEMS Code Swarm

Code Swarm is a tool which visualizes project commit history. It can produce some very cool and interesting output.

Thanks to Peter Burns (a.k.a rictic) for fixing bugs and providing guidance during this. He was most supportive.

Running Code Swarm

#download and extract
curl -L http://github.com/rictic/code_swarm/tarball/master > code_swarm.tar.gz
tar -xzf code_swarm.tar.gz
mv rictic-code_swarm-*/ code_swarm

#add the bin directory to your path
PATH=$PATH:code_swarm/bin

#convert the CVS log
convert_logs.py -c activity.log > log.xml
#get a code_swarm config file (I'd eventually like to remove this step)
cp code_swarm/bin/config.template rtems.config
#run code_swarm on the config file
code_swarm -c rtems.config

At this point, you will have a subdirectory in the code_swarm tree named code_swarm_frame with a lot of .png files. Following the instructions for Generating a Video, I used this command to generate the movie.avi file.

mencoder mf://*.png -mf fps=24:type=png -ovc lavc -oac copy -o movie.avi

If that results in a file that is too large, read the Wiki and try the other alternatives.

This takes between 90 minutes and 6 hours on the RTEMS activity log depending on how many frames per day you generate. At 2 frames per day, it is about 90 minutes and at 6, it is ~6 hours.

Text for Video

The video shows periods of high and low activity. On the videos from other projects, there are subtitles indicating what actually happened in the project at that time.

  • beginning until non-OAR committers added - need date
  • early 1997
  • June 1997
  • October 1997

RTEMS Configuration File

You can try enabling OpenGL support and see if it works for you.

# This is a sample configuration file for code_swarm

# Input file
InputFile=log.xml

# Optional Method instead of MillisecondsPerFrame
FramesPerDay=2

# OpenGL has problems on some platforms.  We're closer to having it work 
# automatically out of the box, but not close enough to enable it by default
UseOpenGL=false

# Color assignment rules
# Keep in order, do not skip numbers. Numbers start
# at 1.
# 
# Pattern:  "Label", "regex", R,G,B, R,G,B
# Label is optional.  If it is omitted, the regex
# will be used.
#
ColorAssign1="Tests",".*test.*", 90,225,90, 110,200,90
ColorAssign2="Build Infrastructure",".*config.*|.*Make.*|.*cfg", 198,229,255, 178,209,235
ColorAssign3="Ports",".*score/cpu.*", 90,225,225, 110,200,200
ColorAssign4="BSPs",".*libbsp.*|.*libcpu.*|.*libchip.*", 30,144,255, 10,124,235
ColorAssign5="Source Code",".*(\.py|\.rb|\.erb|\.hs|\.sql|\.[sSchd]|\.cpp|\.cc|\.m|\.js|\.pl|\.sh|\.java|\.lhs|\.hi|\.ad[abs])", 225,90,90, 200,90,110
ColorAssign6="Documents/Images",".*(\.txt|\.html|\.tex|\.t|\.texinfo|\.texi|\.tmpl|\.css|\.xml|\.yml|\.json|\.png|\.jpg|\.gif|\.jpeg|README|COPYING|LICENSE|AUTHORS)", 90,90,225, 90,110,200

# Save each frame to an image?
TakeSnapshots=true

# Where to save each frame
SnapshotLocation=code_swarm_frames/#####.png

#Is the input xml sorted by date?  It's faster and uses much less memory if it is
IsInputSorted=true
#  - All of the given scripts for producing repository xml files produce sorted data
#  - Please file a bug if one doesn't

# Uncomment to not use avatars
#AvatarFetcher=NoAvatar