May 28, 2017  To install Ubuntu on a computer that currently runs Windows you need to download the installation file. If you want to install Ubuntu on your. Are you looking to install Ubuntu? I’m handy enough with Debian/Ubuntu to install the long chain of deps necessary. How to Create a Screencast in Ubuntu « Ubuntu Blog. Download Ubuntu Desktop.

As the code becomes larger and larger, the number of functions and nested function calls also increase. So, to analyze the performance of such a program, it becomes necessary to understand which functions are taking time to execute. Also, individual function analysis should also provide clear distinguishing between the time taken by the parent function and the other functions called from within the parent function.

Software tools that are used for this kind of performance analysis are popularly known as profilers. In this tutorial, we will discuss a Linux based profiler named as gprof.

All the examples presented in this article are tested on Ubuntu, bash 4.2.45 and gprof 2.23.2.

Gprof Setup & Usage

Ubuntu install gprof

Here are some of the steps required for downloading and setting an environment for gprof:

  • If not installed already, download and install gprof by executing 'apt-get install binutils'
  • To check that gprof is installed properly, execute the gprof command and it should give some error like 'a.out: No such file or directory'.
  • Assuming that the compiler being used it gcc or cc, compile your code with the option '-pg' so that the executable includes extra code for profiling purposes.
  • Run the program in a normal way. When the program terminates, a file named 'gmon.out' (profiler data) would be produced in the same directory from which the program was run.
  • Use the gprof profiler to process this profiler data (gmon.out) and produce human-readable performance analysis and statistics of the program.

Here is an example code that we want to profile:

#include<stdio.h>

void some_other_test(void)
{
printf('n Inside the function some_other_test() n');
int i = 0;
for(;i<=0XFFFF;i++);
}

void yet_another_test(void)
{
printf('n Inside the function yet_other_test() n');
int i = 0;
for(;i<=0XFFFFFFF;i++);
}

void another_test(void)
{
printf('n Inside the function another_test() n');
int i = 0;
for(;i<=0XFFF;i++);

yet_another_test();
}

void test(void)
{
printf('n Inside the function test() n');
int i = 0;
for(;i<=0XFFFFFF;i++);

another_test();
}

int main(void)
{
printf('n Inside the function main() n');
int i = 0;
for(;i<=0XFFFFF;i++);

test();
some_other_test();

return 0;
}

Note that the code above is just a dummy example that contains for loops to simulate time consumption in function processing.

Once the code is in place, the first step is to compile the code. Here is how you can do it :

$ gcc -Wall -pg profile.c -o profile

So you can see that the code was saved in a file named 'profile.c' and the output file name is 'profile'.

Once the executable named 'profile' was produced, it was executed like any other program:

$ ./profile

Inside the function main()

Inside the function test()

How to use gprof

Inside the function another_test()

Inside the function yet_other_test()

Inside the function some_other_test()

So you can see that the program executed successfully. Also, it produced a file named 'gmon.out' in the same directory.

$ ls gmon.out
gmon.out

Now, use the gprof utility in the following way:

$ gprof profile gmon.out > output

So you can see that the executable name and gmon.out were provided as arguments to gprof command and the output was redirected to a file named 'output'. This file contains all the statistical analysis of the performance of the program 'profile' in human-readable form.

The contents of output are divided into types of information -- Flat profile and Call graph.

Flat Profile

Here is the statistical analysis in the form of flat profile:

The statistics displayed above is known as flat profile. Here is the explanation (taken from the file output) of what each column means :

Call Graph

Here is the statistical analysis in form of a call graph:

This table describes the call tree of the program, and was sorted by the total amount of time spent in each function and its children. Each entry in this table consists of several lines. The line with the index number at the left hand margin lists the current function. The lines above it list the functions that called this function, and the lines below it list the functions this one called.

Here is the explanation (taken from the file output) of what each column means:

  • Index - A unique number given to each element of the table. Index numbers are sorted numerically. The index number is printed next to every function name so it is easier to look up where the function is in the table.
  • % time - This is the percentage of the `total' time that was spent in this function and its children. Note that due to different viewpoints, functions excluded by options, etc., these numbers will NOT add up to 100%.
  • Self - This is the total amount of time spent in this function. For function's parents, this is the amount of time that was propagated directly from the function into this parent. While, for function's children, this is the amount of time that was propagated directly from the child into the function.
  • Children - This is the total amount of time propagated into this function by its children. For the function's parents, this is the amount of time that was propagated from the function's children into this parent. While, for the function's children, this is the amount of time that was propagated from the child's children to the function.
  • Called - This is the number of times the function was called. If the function called itself recursively, the number only includes non-recursive calls, and is followed by a `+' and the number of recursive calls. For the function's parents, this is the number of times this parent called the function `/' the total number of times the function was called. Recursive calls to the function are not included in the number after the `/'. While, for the function's children, this is the number of times the function called this child `/' the total number of times the child was called. Recursive calls by the child are not listed in the number after the `/'.
  • Name - The name of the current function. The index number is printed after it. If the function is a member of a cycle, the cycle number is printed between the function's name and the index number. For function's parents, this is the name of the parent. The parent's index number is printed after it. If the parent is a member of a cycle, the cycle number is printed between the name and the index number. For function's children, this is the name of the child. The child's index number is printed after it. If the child is a member of a cycle, the cycle number is printed between the name and the index number.

All the explanation mentioned above is also present in the output file generated by gprof. I have mentioned it here for the ease of readers.

Note: All this explanation is produced in the output file every-time gprof is run. So, once you've understood the details, you can use the gprof command-line option -b. To read more command-line options, read gprof man page.

How to install ddd on Ubuntu 16.04?

First of all update your system with the command:

Ads

Above command will download the package lists for Ubuntu 16.04 on your system. This will update the list of newest versions of packages and its dependencies on your system.

After downloading the latest package list with the help of above you can run the installation process.

Recommended raid block size for mac. Here is what SoftRaid recommends in their help files: ' If you are creating a Stripe volume, you will be asked to specify the stripe unit size for this volume. The possible choices are 32, 64 and 128 Kbytes. If you are creating a volume for a server, you should select 32 Kbytes.

If ddd is not installed on your compter then the command 'dpkg -L ddd' will give followin error.

Installing ddd:

After system update use the following command to install ddd:

Above command will confirm before installing the package on your Ubuntu 16.04 Operating System. Payday 2 best stealth build. If you are not already logged in as su, installer will ask you the root password. After completion of the installation you can use the package on your system.

How to uninstall/remove ddd from Ubuntu 16.04?

Now we will see the commands for uninstalling the ddd from Ubuntu 16.04. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.

To remove the ddd following command is used:

Following command is used to remove the ddd package along with its dependencies:

This will remove ddd and all its dependent packages which is no longer needed in the system.

Completely removing ddd with all configuration files:

Following command should be used with care as it deletes all the configuration files and data:

or you can use following command also:

Above command will remove all the configuration files and data associated with ddd package. You can can't recover the delete data, so, use this command with care.

laserqdy.netlify.app© 2020