Borland® Delphi® 2006, now part of Borland Developer Studio, is a complete environment for visual design, compilation, and debugging of Windows applications. Programs can be targeted for Win32 and Microsoft .NET applications using a common source code base. The Integrated Development Environment (IDE) provides rapid application development with support for Delphi, C, C++, and C# programming languages.
Delphi 2006 is the 10th Windows release of the product since the introduction of version 1.0 in 1995. "It’s grown and evolved substantially over those 10 releases and it is considerably more complex than the fairly basic Rapid Application Development (RAD) tool it was when first released" says Mark Edington, Principal Engineer at Borland. "Over the years, this added complexity has resulted in some bottlenecks surfacing while working in the IDE and in other areas of the product. For the release of Delphi 2006, Borland committed to improving the product's quality and performance. Isolating and addressing performance issues with a product as complex as Delphi absolutely required the use of a capable and powerful profiling tool like AQtime."
AQtime is the first profiler available to the Delphi developer community that truly supports all of the product’s unique profiling challenges. It supports all programming languages supported by Delphi as well as supporting both Win32 and managed .net code in the same profiling session.
"I typically use the AQtime performance profiler to profile very specific operations in our product that could benefit from optimizations. After analyzing the profiler results, I usually make one or more code changes and then run the profiler again and compare the results."
Exciting and Interesting
"As a software developer, AQtime has been one of the most exciting and interesting new tools to go into my toolbox in a long time. The “benefit” is that this tool helps me get a very specific job done and it works VERY well."
AQtime Tackles the Problem
In Delphi 2006, Mark recently ran into some very unfamiliar code with a difficult to debug drag-and-drop problem. He had absolutely no idea where or what that code problem was. "I hadn't debugged drag-and-drop code, and I'm sure anyone who has appreciates the challenges of using the debugger to figure out what is going on during a drag operation. The big problem is that if you want to set a breakpoint in the code that executes when the drag operation begins, you won't be able step though all of the code that needs to execute to complete a drop operation because the mouse messages will not be processed properly by the application while it is stopped in the debugger. As soon as the breakpoint hits, your drag operation is basically cancelled."
"The bug I was working on was being unable to rearrange items in the tool palette using the mouse. On certain systems, the tool palette would simply not allow dragged items to be dropped."
"In this situation, the Delphi IDE uses "OLE" drag and drop which means much of the code that executes during a drag operation is invoked by callbacks from the operating system. Since this callback is called indirectly, it is more difficult to identify. It's awfully tough to set a breakpoint on a line of code when you don't know where it is! The problem was further complicated by the fact that code that should have been executing wasn’t getting called, so even if I knew where to put the breakpoint it wouldn't have worked."
"I decided to use AQtime to tackle this problem. Not only is it a powerful code profiler, it is also a very useful debugging tool. The results it generates show which functions are called, how many times they’re called, and how long each call takes. In addition, it provides a call stack that clearly shows which functions call other functions. Another nice thing about the call stack that AQtime provides is its “static” nature. You don’t have to be sitting on a breakpoint with the program running to review it as you normally would with a debugger."
Debugging with AQtime
Mark found a system that was not affected by the bug and profiled the drag and drop operation. "This gave me a "good" set of profiler data. I copied the results to a system that couldn’t perform the drag and drop. Using the same AQtime project with the good results, I executed the same steps, which failed, under the profiler. This gave me a “bad” set of profiler data. I then used a feature in AQtime which allows you to compare these two sets of results. That allowed me to quickly see which methods were not being called on the computer affected by the bug. Finally, I analyzed the call stacks from each profiler run to determine where the execution paths diverged."
At this point, Mark had the information he needed to jump back into the debugger and set some breakpoints and figure out exactly what was going wrong. "This took me just a couple of minutes, now that I had a clear picture of what the expected code path was. From there I made a few code changes to fix the bug. I'm sure there were probably other ways I could have attacked this bug, and had I gone into this exercise with more background in drag-and-drop code I probably would have known right where to look for the problem without any extra help. Fortunately, having AQtime in my toolbox I knew I could get the job done with this approach."
"It's incredibly useful to have a “static” call stack that you can examine after the fact. You can walk up and down the stack and review the associated code in the code editor window and review any part of the profiler results without having to run the program. Another big advantage of the call stack AQtime provides is that it traverses the .net managed/unmanaged code interop boundary showing you a full picture of the code execution. The IDE debugger only allows you to see either .net or Win32 calls in the call stack, not both.
AQtime Makes It Easy
"Performance is an important element of a product’s quality. Virtually all of the performance optimizations that we have made in Delphi 2006 with the help of AQtime, have resulted in higher quality levels.", said Mark, "AQtime makes it very easy to quickly obtain useful profiling data for any operation that needs to be optimized. In many cases finding the source of a bottleneck is as simple as clicking on a column of results to sort them. Trying to obtain that same data without the use of a profiler like AQtime would not be feasible even given unlimited time resources."
Borland's Take on AQtime
"AQtime is very powerful, fast, flexible, and versatile. Not to mention, easy to use with a well designed UI, that provides consistent results. AQtime is rock solid! If you have an application that needs to be optimized, AQtime will definitely help you get the job done better and faster. If you are working with Delphi code in particular, AQtime is hands down your best option. I highly recommend it", says Mark Edington from Borland.
About Borland Software
Borland Software is a global leader in platform-independent application lifecycle management solutions that partners with customers to help them achieve increasing levels of Software Delivery Optimization. With more than 1,400 employees worldwide and operations in more than 20 countries, Borland has served over 95 percent of global 2000 companies with best-in-class solutions for more than 20 years. Borland is committed to the ongoing delivery of software, services, and partnerships to help our customers cost-effectively transform their software delivery processes, with minimum risk and maximum ROI.
AQtime is a performance profiler and memory debugger engineered to give developers unparalleled insight into all aspects of the performance of their applications. AQtime provides a single solution for detecting performance bottlenecks and memory leaks within managed, unmanaged and mixed-code applications. AQtime supports Microsoft Visual Studio, .NET, ASP.NET, C++, VB, Borland Delphi, Borland C++, and more.
Learn more about AQtime and see for yourself how you can improve performance like Borland. Download a free 30-day trial now.
All company names and/or products referenced herein are either registered trademarks or trademarks of their respective trademark holders.