0% found this document useful (0 votes)
6 views2 pages

Assignment 01 Using GNU Profiler

The assignment focuses on using the GNU Profiler 'gprof' for performance analysis of a given C program. Students are required to describe the functionality of the code, including each function and the overall program behavior, as well as compile and run the profiler to analyze the output. The document emphasizes originality in coding and prohibits plagiarism.

Uploaded by

Shahzaib Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Assignment 01 Using GNU Profiler

The assignment focuses on using the GNU Profiler 'gprof' for performance analysis of a given C program. Students are required to describe the functionality of the code, including each function and the overall program behavior, as well as compile and run the profiler to analyze the output. The document emphasizes originality in coding and prohibits plagiarism.

Uploaded by

Shahzaib Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Parallel and Distributed Programming (CIS-442)

BSCIS – PIEAS

Assignment 01: Using GNU Profiler ‘gprof’

Objectives

1. Profiling a program for Performance Analysis (gprof – Gunu Profiler).

Lab Tasks

1. Look at the code and describe what this code is doing?

2. You need to describe functionality of each function and also overall functionality of program

#include <stdlib.h>
#define N 19999

int func1 ( int ) ;


int func2 ( int ) ;

int main ( )
{
int i , j ;
j = 0 ;
for ( i = 0 ; i <= N; i++)
{
j = func1 ( j ) ;
}
return ( j ) ;
}

int func1 ( int j )


{
int k ;
for ( k = 0 ; k <= N; k++)
j = func2 ( j ) ;
return ( j ) ;
}

int func2 ( int j )


{
j += 1 - 3 / 4 ;
return j ;
}
3. Compile the program then run for profiling as described below. You need to run profiler for
this program and describe about the output in your own words, what you see there.

Compile my_program.c
gcc -pg my_program.c
./a.out

Analyze my_program.c
gprof a.out

Deliverables

You don't need to submit separate document. Simply observe and write in text box provided for this
assignment submission.

Zero tolerance policy for plagiarism. Please come with your own code no matter how bad is it.

You might also like