06-16-2010
Thank you for your answer. Some more guidelines to consider:
1- Static code analysers already check code for bad practices. That is of course not to say that resolving those issues would lead to a better performing program.
2- Recursion is usually a good place to start looking for performance issues.
3- The creation of very large arrays is usually a sign of poor performance, because most of the time only a small portion is needed.
4- Repeated use of input validation. You can never be truly sure the data that the program is operating on is sufficiently sane, so there is a risk trade off between performance and data sanity.
Implementing performance measures always has the downside of micro-optimisation, so that the measures work in only one set up or on a specific data set.
Any more ideas are welcome.
5 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi:
I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library)
Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies
2. IP Networking
hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first.
... (0 Replies)
Discussion started by: dlwoaud
0 Replies
3. Programming
I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies
4. Infrastructure Monitoring
Need assistance in troubleshooting
I have configured awstats 7.3 version on RedHat linux and I am stuck at getting the updates from the website . Please let me know if anybody can give me some inputs
I can see the webpages but it gives "Never updated (See 'Build/Update' on awstats_setup.html... (2 Replies)
Discussion started by: ajayram_arya
2 Replies
5. OS X (Apple)
Well guys, this MUST be a first.
This is DEMO code only and has NO error detection or correction, nor out of bounds checking.
I have succumbed to Python and scipy to do the FFT heavy lifting as I have absolutely no idea where to start do such a thing using AWK. This is a taster for me to... (7 Replies)
Discussion started by: wisecracker
7 Replies
LEARN ABOUT OPENSOLARIS
cpc_disable
cpc_enable(3CPC) CPU Performance Counters Library Functions cpc_enable(3CPC)
NAME
cpc_enable, cpc_disable - enable and disable performance counters
SYNOPSIS
cc [ flag... ] file... -lcpc [ library... ]
#include <libcpc.h>
int cpc_enable(cpc_t *cpc);
int cpc_disable(cpc_t *cpc);
DESCRIPTION
In certain applications, it can be useful to explicitly enable and disable performance counters at different times so that the performance
of a critical algorithm can be examined. The cpc_enable() and cpc_disable() functions can be used to enable and disable the performance
counters without otherwise disturbing the invoking LWP's performance hardware configuration.
RETURN VALUES
Upon successful completion, cpc_enable() and cpc_disable() return 0. Otherwise, they return -1 and set errno to indicate the error.
ERRORS
These functions will fail if:
EAGAIN The associated performance counter context has been invalidated by another process.
EINVAL No performance counter context has been created for the calling LWP.
EXAMPLES
Example 1 Use cpc_enable and cpc_disable to minimize code needed by application.
In the following example, the cpc_enable() and cpc_disable() functions are used to minimize the amount of code that needs to be added to
the application. The cputrack(1) command can be used in conjunction with these functions to provide event programming, sampling, and
reporting facilities.
If the application is instrumented in this way and then started by cputrack with the nouser flag set in the event specification, counting
of user events will only be enabled around the critical code section of interest. If the program is run normally, no harm will ensue.
int
main(int argc, char *argv[])
{
cpc_t *cpc = cpc_open(CPC_VER_CURRENT);
/* ... application code ... */
if (cpc != NULL)
(void) cpc_enable(cpc);
/* ==> Code to be measured goes here <== */
if (cpc != NULL)
(void) cpc_disable(cpc);
/* ... other application code */
}
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
cputrack(1), cpc(3CPC), cpc_open(3CPC), libcpc(3LIB), attributes(5)
SunOS 5.11 31 Jan 2005 cpc_enable(3CPC)