
LuaSandbox::getProfilerFunctionReport 함수는 프로파일러 정보를 리턴하는 함수로, LuaSandBox 내부의 함수 호출 정보를 제공합니다.
이 함수의 리턴 값은 std::vector 형식으로 반환됩니다.
ProfilerFunctionReport는 다음 정보를 포함합니다.
- 함수 이름
- 함수 호출 횟수
- 함수 실행 시간
이 함수를 호출할 때는 LuaSandBox 객체를 참조로 넘겨야 합니다.
예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
cpp
std::vector report = luaSandbox->getProfilerFunctionReport();
for (const auto& func : report) {
std::cout << "Function: " << func.name << std::endl;
std::cout << "Calls: " << func.calls << std::endl;
std::cout << "Time: " << func.time << std::endl;
}
위의 예제는 LuaSandBox 내부의 모든 함수의 프로파일러 정보를 출력하는 예제입니다.
만약 특정 함수의 프로파일러 정보만 얻고 싶다면, 함수 이름을 포함한 ProfilerFunctionReport를 찾는 로직을 추가하면 됩니다.
예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
cpp
std::vector report = luaSandbox->getProfilerFunctionReport();
for (const auto& func : report) {
if (func.name == "특정 함수 이름") {
std::cout << "Function: " << func.name << std::endl;
std::cout << "Calls: " << func.calls << std::endl;
std::cout << "Time: " << func.time << std::endl;
}
}
2025-06-17 04:35