shell program- how many times a function is called
We have a program source C and is required to indicate how many times each function is called from the C program. also print the line number where there is a call.
I've tried something like this:
but for eg. if I give a file that isn't C source it doesn't show the right message.
also I'm not very sure that this is the right way to solve this problem, because it only works for the functions that you read from the keyboard , not for each function that you have in your program.
so if you have other ideas please help.
thank you. and sorry for my bad exprimation.
I want to make a config file which contain all the paths.
i want to read the config file line by line and pass as an argument on my below function.
Replace all the path with reading config path line by line and pass in respective functions.
how can i achieve that?
Kindly guide.
... (6 Replies)
Hi,
I have create a Shell Script, with one function.
I want to call the script file in Java Program.
It working fine. but the problem is the function in the Shell Script is not executed.
Please suggest me,
Regards,
Nanthagopal A (2 Replies)
Hi Experts,
I have a code like this.
=====
#include....
int main()
{
int count = 0;
while(1){
printf("\n Interation number is: %d \n ",count);
rv = system(" test.sh > log.txt " );
if (-1 == rv)
{
printf("Could not generate static log: error... (12 Replies)
Hello,
i'm trying to implement the times() function and i'm programming in C.
I'm using the "struct tms" structure which consists of the fields:
The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process.
The tms_stime structure... (1 Reply)
Hi All,
I have a file which sets all the variables on unix , based on the hostname. Currently these variables are hardcoded in the cobol programs.I was wondering if unix variables can be used in Cobol programs ?
Example :
I have a variable $SHTEMP which is set based on the following :
Prod... (2 Replies)
Hi gurus can you explain following lines of code ?
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
pid_t pid;
int rv;
switch(pid = fork()) {
case -1:
... (7 Replies)
Hello to all,
I am looking for a way to display only the names of function (calls & definition) of a C++ source code.There is already a post related to this, but the script is to find the functions using a specific variable, and the replies are not that convincing since they cannot be used for... (2 Replies)
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
Hi,
I am new to Unix and shell programming.
I am trying to write a shell program to read 4 variables from command line.
For example,
Please enter your name: somebody
Please enter your address: address
plase enter your phone: phone
I'd like to save all threee variables in my program for... (3 Replies)
CLOCK(3) Linux Programmer's Manual CLOCK(3)NAME
clock - Determine processor time
SYNOPSIS
#include <time.h>
clock_t clock(void);
DESCRIPTION
The clock() function returns an approximation of processor time used by the program.
RETURN VALUE
The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC. If the processor
time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
CONFORMING TO
ANSI C. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
NOTES
The C standard allows for arbitrary values at the start of the program; subtract the value returned from a call to clock() at the start of
the program to get maximum portability.
Note that the time can wrap around. On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approx-
imately every 72 minutes.
On several other implementations, the value returned by clock() also includes the times of any children whose status has been collected via
wait() (or another wait-type call). Linux does not include the times of waited-for children in the value returned by clock(). The times()
function, which explicitly returns (separate) information about the caller and its children, may be preferable.
SEE ALSO getrusage(2), times(2)GNU 2002-06-14 CLOCK(3)