Did you know ... | Search Documentation: |
Pack logtalk -- logtalk-3.85.0/tools/ports_profiler/SCRIPT.txt |
This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2023 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
% start by loading the tool:
| ?- {ports_profiler(loader)
}.
...
% the tool requires that the applications to be profiled are compiled in % debug mode as the port data is collected using debug hooks:
| ?- set_logtalk_flag(debug, on)
.
...
% load the application to be profiled:
| ?- {searching(loader)
}.
...
% run a query:
| ?- miss_cann::initial_state(Initial)
, hill_climbing(16)
::solve(miss_cann, Initial, Path, Cost)
, miss_cann::print_path(Path)
.
...
% print the collected profiling data:
| ?- ports_profiler::data.
miss_cann goal_state/2 1 0 13 1 0 12 0 0 miss_cann heuristic/2 0 15 15 15 0 0 0 0 miss_cann initial_state/2 1 0 1 1 0 0 0 0 miss_cann next_state/3 0 66 18 0 38 18 38 0 miss_cann print_state/1 0 12 12 12 0 0 0 0 state_space goal_state/1 0 13 13 1 0 12 0 0 state_space initial_state/1 0 1 1 1 0 0 0 0 state_space member_path/2 0 103 118 22 0 96 0 0 state_space print_path/1 1 12 13 13 0 0 0 0 heuristic_search/1 solve/4 0 1 1 0 1 0 0 0 heuristic_search/1 threshold/1 0 1 1 1 0 0 0 0 hill_climbing/1 hill/7 0 25 13 0 12 1 0 0 hill_climbing/1 search/5 0 1 1 0 1 0 0 0 -------------------------------------------------------------------------------------
% focus on a single entity:
| ?- ports_profiler::data(miss_cann)
.
goal_state/2 1 0 13 1 0 12 0 0 heuristic/2 0 15 15 15 0 0 0 0 initial_state/2 1 0 1 1 0 0 0 0 next_state/3 0 66 18 0 38 18 38 0 print_state/1 0 12 12 12 0 0 0 0 -----------------------------------------------------------------
% focus on a single predicate:
| ?- ports_profiler::data(state_space, print_path/1)
.
1 1 2 12 -------------