Can anyone suggest a good tool to profile a program compiled with SunCC compiler. Also please suggest a good equivalent of valgrind for the same.
The Sun Studio compilers include Performance Analyzer for profiling and Memory Runtime Checking features in the dbx debugger.
See also the answers to Locate bad memory access on Solaris.
DTrace is the best tool for profiling [in] the universe.
DTrace is a comprehensive dynamic tracing framework for the Solaris™ Operating Environment. DTrace provides a powerful infrastructure to permit administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.
It's not marketing, it really allows just that.
The Solaris Dynamic Tracing Guide describes how to use DTrace to observe, debug, and tune system behavior. The DTrace guide also includes a complete reference for bundled DTrace observability tools and the D programming language.
DTrace is also available in Mac OS X, (there's a nice GUI for it, Instruments), and a FreeBSD port that has only kernel mode providers is also available.