Blog

Archive for the ‘Tips’ Category

Line and Statement Counting Metrics

Monday, March 22nd, 2010

Understand has many different metrics, including a large number that focus on counting the number of statements and lines of code, including Lines of Code (LOC or SLOC), Lines with Comments (CLOC), empty lines (BLOC), Number of Statements, Number of Executable Statements, etc.

The short C/C++ example below shows how each line and statement contribute to these metrics in Understand. You can view the larger version here.

 

2.5 Upgrade Free if Maintenance Current

Monday, March 15th, 2010

image

We have made a lot of changes to the licensing in Understand 2.5. How does this affect you?

  1. These changes require a new license key.
  2. All Understand features are now available to all users

As always, as long as your maintenance is up-to-date, there is no cost for the new version of Understand, we just need to generate a new license for you. The dialog that pops up when you start Understand has three options for getting that new license, whichever you choose, we will get the license to you quickly and without any hassle.

What if your maintenance is not current? You can still use any of these options, and we will get you a quote for getting back up-to-date. Also, the 2.5 install does not overwrite your previous version, so you can continue to use Understand 2.0 with your previous license.

(more…)

GDB and Understand

Tuesday, December 30th, 2008

About 1/2 our engineers program on Linux. A couple use the Mac. And the rest use Windows.

On Linux and the Mac it is quite common to have command line GDB session in use for debugging and to need to inspect or walk a call stack from the “where” command.  It is a bit of a pain to have these separated from Understand. And we may (if we can figure out the Windows side) add debugging support directly into Understand, but until here is a tip that makes working with GDB a bit easier.

With B465 you paste any text into a command result window (get one by choosing “Options->Run a command”).  Once pasted, we analyze it for file, line and entity names and it becomes clickable for Understand events and menus.

Here is a GDB call stack pasted in:

 Gdb_

Files and lines are identified so I can visit them in Understand, or right click and get information and graphs.

Also, with B465 we have made file detection much smarter. It will recognize short, relative and full path names and associate line numbers with them in any fashion a compiler or other tool can think to spit them out.

 

Yes! Searching in Graphs

Tuesday, December 30th, 2008

Searching in graphs has been on my Understand wish list since we first added graphs – 10 years ago!

So I’m quite happy to report that Understand 2.0 Build 466 has searching in graphs. To search in a graph just hit the binocular button and enter in the search text. It is incremental. As you type, it matches. Hit return to move to the next, or use the green arrows. The graph will center to the next match. Searches will find on node labels and edge labels (if the graph has them).

Here I search a large call tree for “inflate”:

31 2008-12-30 13.51

 

Tip – Beautify your code

Thursday, November 6th, 2008

Your code is beautiful, formatted to your liking and spaced just how you want it, but sometimes you have to work with other people’s code – yuck! If only there was something that would make it look like your code, instead of spaghetti. Artistic Style, or astyle as it is also known, is a great open source application that does exactly that.

So you can quickly turn this:

image

Into this:

image

We plan on implementing astyle into the editor at some point in the future, but I’m not so patient, and I decided to use our plugin mechanism to do it now, and will show you how.

(more…)

Tip – Understand the CountPath Metric

Tuesday, October 21st, 2008

So imagine you’re reviewing metrics for a small function:

  61 lines of code, pretty small, keeping functionality nice and modular. Good.

  Cyclomatic complexity of 30. Highly complex, but within the acceptable range. Good.

  CountPath metric 536,870,912. What is this? 536 Million paths in 61 lines of code, that can’t be right, can it?!?

(more…)

Tip – Automated Metrics

Monday, October 13th, 2008

Several people have asked me lately about automating metrics with Understand 2.0. There are two quick ways to automate metrics, as a scheduled activity and via the command line:

(more…)

Tip – Finding unused functions in a specific class

Tuesday, September 30th, 2008

I was walking down to the kitchen to get my afternoon cookie and I met another of our engineers. He asked “hey, how would I use Understand to clean up a class of functions that are no longer used?”. I thought for a bit and said “piece of cake”.

In short…. use the entity filter window to filter on “unused functions”, turn entity->long names on, then type in the name of the class. Done. 

Here are the steps….  First select the “Unused Functions” filter in the Entity Filter window:

2008-09-30 16.36

(more…)

Understand 2.0 New Feature: Editor Macros

Thursday, September 18th, 2008

We are busy internationalizing important messages in Understand 2.0 so that they can be translated into Japanese. This involves a lot of changes that are identical. For instance, all translatable strings have to be turned into functions that go through a translation function “tr()” that will table lookup the string to the corresponding Japanese translation.

So take for instance this section of code:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := “Four score and seven years ago our fathers brought forth,” & EOL &
        “upon this continent, a new nation, conceived in liberty,” & EOL &
        “and dedicated to the proposition that `all men are created equal’.”;

I’ve got to make it look like this:

procedure Buffer_Demo is
   EOL  : Character renames ASCII.LF;
   Text : constant String
     := tr(“Four score and seven years ago our fathers brought forth,”) & EOL &
        tr(“upon this continent, a new nation, conceived in liberty,”) & EOL &
        tr(“and dedicated to the proposition that `all men are created equal’.”);

Fortunately, Understand 2.0 can record editor macros that make repeated tasks easy and possibly fun.

Here is how…

(more…)

Understand 2.0: Favorites

Thursday, September 18th, 2008

Understand 2.0 Favorites lets you organize locations (file/line#) or entities (e.g function foo, file foo.cpp) into a named folders.

Favorites can be “project favorites”, where they are only applicable to the .udb file open when you made them, or “all project favorites”, which are available no matter what project you have loaded.  The “All Projects” variety is useful to me since I have dozens of projects of largely the same source that I use for different testing/evaluation purposes.

Favorites are shown in the “Favorites” window, which you can show by clicking on the 2008-09-18 13.55 toolbar (or by Windows->Favorites).

I have my favorites organized into three folders:

2008-09-18 13.56

I give a lot of web and in-person demos of Understand, “Good Demos” is where I store classes, functions, and files that help me simply explain the kinds of things Understand does. For instance, here I have classes and functions and a “butterfly” view with the [x] Sync box checked. In a demo, I can just click on the favorite and see the graph update auto-magically.

2008-09-18 14.04

“Interfaces” provides a handy spot to stash a quick way to see the API’s we often work against here. For instance, the “Understand database API (udb)” or “Change API”.  If I need to know the UDB API details, I just click on it and up comes the source:

2008-09-18 14.07

“ToDo” stores places I want to take a peek at again later. Often this is when I find a spot, or a user reports a spot, where a  crash or bug can be replicated.  It is empty now, but let’s pretend I want to come back and look at a spot here in the UDB interface.

First I just click in the editor where I want to remember. Then pull down the Favorites toolbar menu:

2008-09-18 14.09

It asks me to place the favorite, and I specify “All Projects” and put it inside “ToDo”:

2008-09-18 14.10

It is now in my Favorites and I can visit it just by double clicking on it:

14 2008-09-18 14.11