Search

'C & C++'에 해당되는 글 3건

  1. 2011.05.04 valgrind를 이용한 C/C++ 디버깅
  2. 2011.05.03 openMP in C/C++
  3. 2011.04.29 C++ deguggin using Visual Studio

valgrind를 이용한 C/C++ 디버깅

C & C++ 2011. 5. 4. 11:29 Posted by TUNALEE

valgrind

설치:
# apt-get install valgrind
or
# yum install valgrind

callgrind 도구와 연동
$ valgrind --tool=callgrind ./a.out

결과 보기
$ kcachegrind callgrind.out.xxxxx

ref.
http://hermet.pe.kr/111117366


GNU profiler

compile
$ g++ -pg example.c

일반적인 방법으로 실행
$ ./a.out

See 'flat profile'
$ gprof ./a.out gmon.out -p

ref.
http://www.ibm.com/developerworks/library/l-gnuprof.html


프로그램 실행 시간 보기

$ time ./a.out

'C & C++' 카테고리의 다른 글

openMP in C/C++  (0) 2011.05.03
C++ deguggin using Visual Studio  (0) 2011.04.29

openMP in C/C++

C & C++ 2011. 5. 3. 19:08 Posted by TUNALEE

1. C

compile: $ gcc -fopenmp a.cpp



2. C++

a.cpp

#include <stdio.h>
#include <iostream>
#include <omp.h>

using namespace std;

int main(void)
{
    int i=0;
    omp_set_num_threads(4);

#pragma omp parallel for
    for(i=0; i<20; i++)
        printf("id %d : Hello ! %d \n", omp_get_thread_num(), i);

    return 0;
}

compile: $ g++ -fopenmp a.cpp

Visual Studio: 솔루션 속성 - 구성 속성 - NMake - 빌드 명령줄: cl a.cpp /openmp


http://msdn.microsoft.com/ko-kr/library/fw509c3b%28v=vs.80%29.aspx
http://hermet.pe.kr/111117366

'C & C++' 카테고리의 다른 글

valgrind를 이용한 C/C++ 디버깅  (0) 2011.05.04
C++ deguggin using Visual Studio  (0) 2011.04.29

C++ deguggin using Visual Studio

C & C++ 2011. 4. 29. 00:29 Posted by TUNALEE

Visual Studio (using cl.exe)


cl(.exe)은 VC++의 컴파일러/링커이며 이 때 Output file name은 소스(.cpp) 파일의 이름과 같다.
/Zi는 디버깅 정보를 포함할 것을 지시하는 옵션
이다.

이렇게 해서 컴파일을 하면 Visual Studio의 편리한 debugging tool (F9로 break point 설정, F5로 진행 등) 을 정상적으로 사용할 수 있다.



Visual Studio (using g++; 이것은 참고용)



References (DDK)

http://blog.naver.com/semigifn?Redirect=Log&logNo=9043533
http://blog.daum.net/z-dream/17280591


'C & C++' 카테고리의 다른 글

valgrind를 이용한 C/C++ 디버깅  (0) 2011.05.04
openMP in C/C++  (0) 2011.05.03