Sponsored Content
Top Forums Programming performance issues of calling a function in if condition Post 302410057 by Franklin52 on Sunday 4th of April 2010 08:11:08 AM
Old 04-04-2010
The second way should be more efficient. Or even:
Code:
if(myfunction(input)) {
  // true
}
else {
  // false
}

 

10 More Discussions You Might Find Interesting

1. Solaris

raidctl performance issues

using the internal 2 drives mirror was created using raidctl on 100's of our servers . sometime when one drive fails we dont face any issue & we replace the drive with out any problem . but sometimes when one drive fails , system becomes unresponsive and doesnot allow us to login , the only way to... (1 Reply)
Discussion started by: skamal4u
1 Replies

2. UNIX for Dummies Questions & Answers

Awk Performance Issues

Hi All, I'm facing an issue in my awk script. The script is processing a large text file having the details of a number of persons, each person's details being written from 100 to 250 tags as given below: 100 START| 101klklk| ... 245 opr| 246 55| 250 END| 100 START| ... 245 pp| 246... (4 Replies)
Discussion started by: pgp_acc1
4 Replies

3. Shell Programming and Scripting

Return a value from called function to the calling function

I have two scripts. script1.sh looks -------------------------------- #!/bin/bash display() { echo "Welcome to Unix" } display ----------------------------- Script2.sh #!/bin/bash sh script1.sh //simply calling script1.sh ------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies

4. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

5. AIX

Performance issues for LPAR with GPFS 3.4

Hi, We have GPFS 3.4 Installed on two AIX 6.1 Nodes. We have 3 GPFS Mount points: /abc01 4TB (Comprises of 14 x 300GB disks from XIV SAN) /abc02 4TB (Comprises of 14 x 300GB disks from XIV SAN) /abc03 1TB ((Comprises of Multiple 300GB disks from XIV SAN) Now these 40... (1 Reply)
Discussion started by: aixromeo
1 Replies

6. Shell Programming and Scripting

perl -Calling the Subroutine Only if the condition is met

Hello All, I am in the process of learning perl.I have a perl script and based on the arguments passed it would the appropriate subroutine that is defined in the script. Now, I need to check a value that is defined in the Environment variables and should call the subroutine only if the... (1 Reply)
Discussion started by: filter
1 Replies

7. Solaris

Getcwd performance issues

Hello everyone, recently we have been experiencing performance issues with chmod. We managed to narrow it down to getcwd. The following folder exists: /Folder1/subfol1/subfol2/subfol3 cd /Folder1/subfol1/subfol2/subfol3 truss -D pwd 2>&1 | grep getcwd 0.0001... (4 Replies)
Discussion started by: KotekBury
4 Replies

8. AIX

AIX 6.1 Memory Performance issues

Good Day Everyone, Just wonder anyone has encounter AIX 6.1 Memory Performance issues ? What I have in my current scenario is we have 3 datastage servers (Segregate server and EE jobs - for those who know Datastage achitect) and 2 db servers(running HA to load balance 4 nodes partitions for... (3 Replies)
Discussion started by: ckwan
3 Replies

9. Shell Programming and Scripting

Help to Modify File Name in each function before calling another function.

I have a script which does gunzip, zip and untar. Input to the script is file name and file directory (where file is located) I am reading the input parameters as follows: FILENAME=$1 FILEDIR=$2 I have created 3 functions that are as follows: 1) gunzip file 2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies

10. What is on Your Mind?

Baiduspider and Forum Performance Issues

For years we blocked Baiduspider due to the fact their bots do not obey the robots.txt directive and can really hurt site performance when they unleash 100 bots on the site each pulling pages many times per second. Last year, I unblocked Baiduspider's IP addresses, and now the problem is back. ... (1 Reply)
Discussion started by: Neo
1 Replies
cpc_count_usr_events(3CPC)												cpc_count_usr_events(3CPC)

NAME
cpc_count_usr_events, cpc_count_sys_events - enable and disable performance counters SYNOPSIS
cc [ flag... ] file... -lcpc [ library... ] #include <libcpc.h> int cpc_count_usr_events(int enable); int cpc_count_sys_events(int enable); 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_count_usr_events() function can be used to control whether events are counted on behalf of the application running in user mode, while cpc_count_sys_events() can be used to control whether events are counted on behalf of the application while it is running in the kernel, without otherwise disturbing the binding of events to the invoking LWP. If the enable argu- ment is non-zero, counting of events is enabled, otherwise they are disabled. Upon successful completion, cpc_count_usr_events() and cpc_count_sys_events() return 0. Otherwise, the functions return -1 and set errno to indicate the error. The cpc_count_usr_events() and cpc_count_sys_events() functions will fail if: EAGAIN The associated performance counter context has been invalidated by another process. EINVAL No performance counter context has been created, or an attempt was made to enable system events while delivering counter overflow signals. Example 1: Use cpc_count_usr_events() to minimize code needed by application. In this example, the routine cpc_count_usr_events() is 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 interfaces 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 have_counters = 0; int main(int argc, char *argv[]) { if (cpc_version(CPC_VER_CURRENT) == CPC_VER_CURRENT && cpc_getcpuver() != -1 && cpc_access() == 0) have_counters = 1; /* ... other application code */ if (have_counters) (void) cpc_count_usr_events(1); /* ==> Code to be measured goes here <== */ if (have_counters) (void) cpc_count_usr_events(0); /* ... other application code */ } See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ cputrack(1), cpc(3CPC), cpc_access(3CPC), cpc_bind_event(3CPC), cpc_enable(3CPC), cpc_getcpuver(3CPC), cpc_pctx_bind_event(3CPC), cpc_ver- sion(3CPC), libcpc(3LIB), attributes(5) The cpc_count_usr_events() and cpc_count_sys_events() functions exist for binary compatibility only. Source containing these functions will not compile. These functions are obsolete and might be removed in a future release. Applications should use cpc_enable(3CPC) instead. 28 Mar 2005 cpc_count_usr_events(3CPC)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy