WinSAG: Windows GUI for Simian (& other tools)

kannanmr on April 12th, 2008

WinSAG_Star Recently one of my peers inherited some legacy code from an Israel team. It had around 800 C/C++ language files and 30 ASM files. The task for my peer was to somehow make sense out of it and port that to an embedded environment with a big size restriction. The size of the code had to be reduced by at least 40%. Just to get him started on that, I thought of developing a new tool that could find the code duplicates. A quick Google search revealed the excellent Simian. Since, it met all our needs, my colleague has decided to buy a license to the tool and use it for his needs.

I spent a day trying out all it’s options. They have a neat ANT task, as well as an Eclipse plugin for Java developers, while nothing for any of the VisualStudio.NET IDEs! There is a command line tool though, thankfully. I put together a small GUI front end for this tool. Check it out if you are interested. Note that this tool was put together in a very short time and so didn’t go through any proper testing & I don’t intend to put it through one, in the near future. I have used this in my house for 2 days now and it hasn’t crashed yet.

This tool is in public domain and totally free. You can do whatever you want to with the source, though a line of credit will be nice. A post card or an email will be appreciated too. You cannot hold me responsible for any damage caused by this tool or the source code :)

 WinSAG MainScreen

WinSAG FAQ:

I will keep this updated with any interesting/often repeated questions. Last updated: April 12, 2008 1700 IST

What is WinSAG?

WinSAG is a small Windows utility written in C# 2.0. It acts as a front end GUI for the excellent tool Simian.

Why call this WinSAG?

WinSAG is a bad acronym for "Windows Similarity Analyzer GUI" (I know it sucks, but hey..I wanted to write a tool, not win a naming contest! Any clever name suggestions are welcome, though)

Where to get it?

Click here to download WinSAG v1.0. Don’t be fooled by the v1.0 tag. This is still only Alpha.

What are the SW requirements?

WinSAG needs .NET runtime 2.0. You can get it here. You also need Simian.

How to use it?

It is not actually difficult, trust me. The following pictorial tour should help you setup a project and execute Simian on your source files. For this tour, I used eMule 0.48a source base & Simian 2.2.24. Also, download and unzip the WinSAG from this page in to some directory in your hard disk.

Step 1:

First step is to tell WinSAG where your Simian binary is. Go to the directory where you unzipped WinSAG. Open winsag.exe.config file in notepad. Modify the following fields accordingly.

<setting name="ToolName" serializeAs="String">
      <value>simian-2.2.24.exe</value>
</setting>
<setting name="ToolPath" serializeAs="String">
      <value>F:\Tools\bin</value>
</setting>
<setting name="ToolStyleSheet" serializeAs="String">
      <value>F:\Tools\simian.xsl</value>
</setting>

Fret not, this is a one time activity. Once the values are setup, fire  up WinSAG. Now, choose File => Preferences. You should see the values you put in  here.

Preferences Dialog

The TimeOut value specifies the maximum time (in milliseconds) WinSAG has to wait for Simian to finish its execution. If the specified time elapses, WinSAG forcefully terminates Simian. The default value is 1 minute (or 60sec). Try changing this value if you want WinSAG to give more time to Simian. A "-1" (negative one) in this field will make WinSAG wait indefinitely.

Step 2:

Lets create a new project. A project file consists of information needed to run Simian (or other similarity analysis tools) again on the specified source files with the specified options. You can save this file and move it to a different computer with WinSAG to do the same operation there.

Choose Project => New.

new Project

Choose the directory where you want WinSAG to save this project file. In our example, I named the project file "emuleProject.wsp". WSP is the standard extension for WinSAG project files.

Step 3: 

WinSAG opens up the project properties window. This dialog box is shown whenever you create a new project or whenever you open an existing WinSAG project file. You can set or edit all the Simian options through this box.

Project Properties

For our example, just give a name to the project and specify the eMule source directory.

Step 4:

Now that all the options are set, press Ctrl-F5 or choose Project => Find Duplicates. WinSAG will invoke Simian. While Simian is still running, you will see a progress bar as shown below.

WinSAG Working 

Step 5:

Results

WinSAG collects the results from Simian and shows it in the results window. You can click on any of the links there to move to the proper file.

Note that if WinSAG doesn’t find a XSL (specified through Winsag.exe.config file), it resorts to the embedded simian.xsl. You can specify any XSL for processing the results.

In our example, Simian reports that eMule 0.48a source has around 10% duplicates. Not bad, eh!?

Percentage Duplication in Emule 0.48a source 

Found a bug. What do I do?

Mail me the details. I’ll look in to it when I get some free time.

Can I get the sources?

Sure. The source files are available via Google Code. Visit http://code.google.com/p/winsag/.

Future plans:

  • Make the preferences editable from the GUI
  • Support other Similarity Analysis tools.
  • Fix the bugs :)
  • Port this to Java (Owner: my wife!)

Download

Download WinSAG [04122008] Version 1

Downloaded a total of 95 times

One Response to “WinSAG: Windows GUI for Simian (& other tools)”

  1. 4j7gkiqu6b5j30co

Trackbacks/Pingbacks

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>