Friday, October 22, 2010

Parallel Workstation Extreme

Tip - Parallels Workstation Extreme is a virtualization platform that enables end-users to experience dedicated host graphic and networking resources in a virtualized environment.

Details - Parallels Workstation Extreme is a software product that enables to create virtual machines on any PC with a 1.66 GHz (minimum) Intel® processor with the Intel VT-x hardware virtualization technology support. If the host computer has an Intel VT-d chipset and an additional PCIe video adapter (except for the one used by the host computer) in its configuration, we can add this video adapter to the virtual machine. The virtual machine will directly access this video adapter without using the resources of the primary OS. Before adding a video adapter to the virtual machine, it should be assigned to the virtual machines in the Intel VT-d pane of Parallels Workstation Extreme Preferences.

Like other virtualization software, Parallels Workstation Extreme uses a hypervisor [See previous posts] to grant its virtual machines’ direct access to the host computer’s hardware. Previously, users could not virtualize these kinds of high-end graphics programs because virtualization did not support the program’s hardware requirements such as dedicated graphics cards, large allocations of memory, and multiple CPUs. To let users virtualize these resource-intensive programs, Parallels partnered with Intel and NVidia and incorporated their technologies into Parallels Workstation Extreme.

References - 

Posted by - Shiju CK

Wednesday, October 20, 2010

Useful WinDbg Commands

Tip - Introducing some useful commands for analyzing crash dump files in WinDbg.

Details - WinDbg (Windows Debugger) is a powerful Windows-based debugging tool for user-mode and kernel-mode debugging. Following are some commands used to analyze dump files in WinDbg.


For more information about WinDbg and its commands, please refer the following links.

References - 

Posted by - Shiju CK

MultiMedia Timers

Tip - Multimedia timer services allow applications to schedule timer events with the greatest resolution (or accuracy) possible for the hardware platform.

Details - Multimedia timer services allow you to schedule timer events at a higher resolution than other timer services. Multimedia timer does not post any messages to message queues. Instead, it calls the specified callback function directly on a separate thread. Therefore, it is more accurate than the standard Win32 timer. The minimum interval that can achieve in Win32 timer is about 16 millisecond, but in multimedia timer, it is about 1 millisecond.
To use multimedia timers in your projects, you should include Mmsystem.h, and link it with Winmm.lib.
Different systems support different minimum values for the multimedia timer resolution. We can get these values like below. And we need to set the minimum resolution by calling timeBeginPeriod function.


  

Now that we set the resolution, let's create the timer. The multimedia timer equivalent of SetTimer, looks like this


 

If uPeriod_i is not in the range of the minimum and maximum event delays supported by the timer, the function returns an error. The callback function is declared like this



Eventually, we will need to destroy the timer. We can accomplish this by a call the function below,


Posted by - Shiju CK

An introduction to OpenCV

Tip - OpenCV is an open source computer vision library in C/C++. It focuses mainly on real-time image processing.

Details - OpenCV is a computer vision library originally developed by Intel and now supported by Willow Garage. It is free for use under the open source BSD license. The library is cross-platform. Basically it is a collection of C functions and a few C++ classes that implement many popular Image Processing and Computer Vision algorithms. If the library finds Intel's Integrated Performance Primitives (IPP) on the system, it will use these commercial optimized routines to accelerate itself. The library is mainly written in C. Then, OpenCV itself can be built with OpenMP support, and, starting with v2.0, OpenCV includes SSE2-optimized code, so many of the functions run significantly faster on the modern 32-bit x86 and 64-bit x64 platforms, and even faster on dual-, quad- and many-core systems.

The main features are,
1. Image data manipulation (allocation, release, copying, setting, conversion).
2. Basic image processing (filtering, edge detection, corner detection, sampling and interpolation, color conversion, morphological operations, histograms, image pyramids).
3. Motion analysis (optical flow, motion segmentation, and tracking).
4. Object recognition (eigen-methods, HMM).
5. Basic GUI (display image/video, keyboard and mouse handling, scroll-bars).
6. Image labeling (line, conic, polygon, text drawing)

References-
http://hawaiilibrary.net/eBooks/Give-Away/Technical_eBooks/OpenCVReferenceManual.pdf
http://opencv.willowgarage.com/wiki/
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html

Posted by - Shiju CK

Sunday, October 17, 2010

Using SetUnhandledExceptionFilter API

Tip - SetUnhandledExceptionFilter enables an application to supersede the top-level exception handler of each thread of a process.

Details - After calling this function, if an exception occurs in a process that is not being debugged, and the exception makes it to the unhandled exception filter, that filter will call the exception filter function specified as parameter.

Here, MyCustomFilter is a pointer to a top-level exception filter function that will be called whenever the SetUnhandledExceptionFilter function gets control, and the process is not being debugged. See the attached sample application


Issuing SetUnhandledExceptionFilter replaces the existing top-level exception filter for all existing and all future threads in the calling process. This method is useful for generating application minidumps during crash and these minidumps can be easily debugged through WinDebug.

Posted by - Shiju CK

Friday, October 15, 2010

Using Tracepoints for debugging

Tip - Using Tracepoints in Visual Studio Debugger.

Details – All programmers are familiar with break points while debugging. But sometimes during debugging it’s not possible to interrupt the program execution. The correctness of the program may affected by the delay introduced by the debugger. In such cases we can use trace points. As the name resembles break points breaks the execution of the program while trace points doesn’t (or optional). Trace points provide additional options to know the debugging information on Trace point location. This feature is available since Visual Studio 2005.

You can put the trace point as follows.

Insert Trace point

Set trace point parameters.
The dialog box itself contains how to format information with variables and other parameters.


The output will be displayed in the output window. An example is given below

IN: 20Fxn: DisplayFxn(int),Thread: 0x140C Thread2 CPU Tick:0x4EC5FE Call Stack:      TracePointSample.exe!DisplayFxn()
      TracePointSample.exe!ProcessValue()
      TracePointSample.exe!Thread2()
      kernel32.dll!76ea36d6()
      [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
      ntdll.dll!77a5883c()
      ntdll.dll!77a5880f()

IN: 11Fxn: DisplayFxn(int),Thread: 0xF74 Thread1 CPU Tick:0x4EC6C9 Call Stack:      TracePointSample.exe!DisplayFxn()
      TracePointSample.exe!ProcessValue()
      TracePointSample.exe!Thread1()
      kernel32.dll!76ea36d6()
      [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
      ntdll.dll!77a5883c()
      ntdll.dll!77a5880f()

PS: Please not that the interface for setting trace point may vary on each version of Visual Studio. The screenshot given above it taken from Visual Studio 2010.

Reference:
http://msdn.microsoft.com/en-us/library/232dxah7.aspx
http://codereflect.com/2009/02/12/using-trace-points-in-visual-studio-for-debugging/

Posted by - Sarath C

Thursday, October 14, 2010

How to know Windows platform support

Tip – How to know Windows platform support
 
Details – Using GetSystemInfo and GetNativeSystemInfo API

GetSystemInfo – This API can return the system information including the platform support.
GetNativeSystemInfo – If 32 bit application is running in 64 bit operating system (WOW64), the GetSystemInfo API returns the platform as 32bit. If the (32-bit) application is particular about getting the true underlying platform, we can use this API. (e.g. If we run ProcessExplorer in 64 bit Windows, the basic itself extract another EXE to take the full advantage of 64-bit OS. The original Process Explorer is 32 bit process. In this kind of situations, we can use GetNativeSystemInfo. Generally we may have to GetSystemInfo only.
Using pointer size

if(sizeof(void*) == 4 )
// 32 bit
else(sizeof(void*) == 8 )
// 64 bit
(This method is not advised. Better using the API itself)


Reference
http://codereflect.com/2010/10/09/getting-processor-architecture-in-x86-and-x64-bit-platform/
http://msdn.microsoft.com/en-us/library/ms724340(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms724381(VS.85).aspx

Posted by - Sarath C