The default (“classic”) settings of the profiler has some incorrect port counts. Some work was done a while ago to fix this but some of the documentation is still sitting in a PR (Draft updated doc for profiler by ridgeworks · Pull Request #1144 · SWI-Prolog/swipl-devel · GitHub).
In any case, if you want accurate port counts include ports(true)
in the option list of profile/2 .