0

I have the unknown source file in my report which make me impossible to fine the correct loop to analyze my report

I want to show the source code with the vtune analyze, however if i compile the c and get the execute file. When i try to analyze the behavior, i can only check the assembly code! Any one got idea how to show the source code? also if i want to do itt_pause() and itt_resum() how am i suppose to do that with out the icc compiler i compile the file as

gcc -c -std=c99 -O2 app.c
gcc -o app app.o

source code that i need to analyze:

#include <stdio.h>
#include <stdlib.h>


int foo_data_collected1()
{
    int sum = 0;
    for (int i = 0; i < 100; i++)
    {
        if ((i & 0xffffffff) == 0)
        {
            sum++;
            printf("T");
        }
        printf("F");
    }

    return sum;
}


int foo_data_collected2()
{
    int sum = 0;
    for (int i = 0; i < 10000000L; i++)
    {
        if ((i & 2) == 0)
        {
            sum++;

        }
    }

    return sum;
}

int foo_data_collected3()
{
    int sum = 0;
    for (int i = 0; i < 10000000L; i++)
    {
        if ((i & 0x80000000) == 0)
        {
            sum++;
        }
    }

    return sum;
}

int foo_data_collected4()
{
    int sum = 0;
    for (int i = 0; i < 10000000L; i++)
    {
        if ((i & 4) == 0)
        {
            sum++;
        }
    }

    return sum;
}

int foo_data_collected5()
{
    int sum = 0;
    for (int i = 0; i < 10000000L; i++)
    {
        if ((i & 3) == 0)
        {
            sum++;
        }
    }

    return sum;
}

int main()
{

    int sum = 0;

    sum = foo_data_collected1();

    printf("\nSum = %d\n", sum);


    return 0;
}
keivn
  • 114
  • 3
  • 12

1 Answers1

4

Use -g compiler option when you are compiling your sources to add debug information.

gcc -g -c -std=c99 -O2 app.c
gcc -o app app.o
Elalfer
  • 5,312
  • 20
  • 25