나는 2 개의 프로필에 cpp 코드를 사용하려고합니다. -pg 플래그로 컴파일하고 출력 결과를 얻기 위해 프로파일을 작성한 후에 매우 이상한 함수 이름을 얻었습니다. 이것은 gprof은 출력의 샘플입니다gprof가 엉망이되었습니다
# Makefile for parallel simulated annealer
PREFIX=${PARSECDIR}/pkgs/kernels/canneal/inst/${PARSECPLAT}
TARGET=canneal
LIBS:=$(LIBS) -lm
CXXFLAGS+=-pg
ifdef version
ifeq "$(version)" "pthreads"
CXXFLAGS+=-DENABLE_THREADS -pthread
endif
endif
all:
$(CXX) $(CXXFLAGS) annealer_thread.cpp -c -o annealer_thread.o
$(CXX) $(CXXFLAGS) rng.cpp -c -o rng.o
$(CXX) $(CXXFLAGS) netlist.cpp -c -o netlist.o
$(CXX) $(CXXFLAGS) main.cpp -c -o main.o
$(CXX) $(CXXFLAGS) netlist_elem.cpp -c -o netlist_elem.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) *.o $(LIBS) -o $(TARGET)
clean:
rm -f *.o $(TARGET)
install:
mkdir -p $(PREFIX)/bin
cp -f $(TARGET) $(PREFIX)/bin/$(TARGET)
: 이 내가 사용하고있는 메이크업 파일입니다
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
11.21 0.73 0.73 2800002 0.00 0.00 std::_Rb_tree<std::string, std::pair<std::string const, netlist_elem*>, std::_Select1st<std::pair<std::string const, netlist_elem*> >, std::less<std::string>, std::allocator<std::pair<std::string const, netlist_elem*> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<std::string const, netlist_elem*> >*, std::_Rb_tree_node<std::pair<std::string const, netlist_elem*> >*, std::string const&)
10.45 1.41 0.68 5856992 0.00 0.00 atomic_load_acq_int(unsigned int volatile*)
8.76 1.98 0.57 400001 0.00 0.00 netlist_elem::routing_cost_given_loc(location_t)
이러한 파일의 실제 함수 이름입니다 :
void annealer_thread::Run()
어떤 깃발을 잊어 버렸습니까? 프로파일 링이 함수의 매개 변수를 표시하는 이유는 무엇입니까? 그들이 수업 이니까? 그것이 cpp이기 때문입니까? 나는 gprof의와 C 익숙하지만이
어떤 도움을 환영합니다 :) 환호 =)
평범하지 않은 프로그램에서 평상시처럼 CPU 시간은 대부분 라이브러리 루틴에 소비되므로 호출 된 방법에 대해 많이 알려주지 않습니다. 이러한 질문에 대한 답변을 얻더라도 [gprof를 사용하면 더 많은 질문을하게 될 것입니다] (http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343). –