What is wrong with this code?

using PProf
using Profile.Allocs

PProf.Allocs.to_pprof

UndefVarError: to_pprof not defined

Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:31
 [2] top-level scope
   @ In[43]:1
 [3] eval
   @ .\boot.jl:368 [inlined]
 [4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base .\loading.jl:1428

I just get the code from https://github.com/JuliaLang/julia/pull/42768.

Are you on Julia 1.8?

Yes

Julia Version 1.8.0
Commit 5544a0fab7 (2022-08-17 13:38 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12700K
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, goldmont)
  Threads: 14 on 20 virtual cores
Environment:
  JULIA_NUM_THREADS = 14

This is the my package evirenment:

Status `C:\Users\User\.julia\environments\v1.8\Project.toml`
⌃ [79c8b4cd] AMQPClient v0.4.4
  [39de3d68] AxisArrays v0.4.6
  [6e4b80f9] BenchmarkTools v1.3.1
  [336ed68f] CSV v0.10.4
  [9961bab8] Cbc v1.0.1
  [e2554f3b] Clp v1.0.1
  [a93c6f00] DataFrames v1.3.4
⌃ [864edb3b] DataStructures v0.18.11
⌃ [85a47980] Dictionaries v0.3.20
⌃ [0c46a032] DifferentialEquations v7.1.0
⌃ [31c24e10] Distributions v0.25.62
  [e2ba6199] ExprTools v0.1.8
⌃ [60bf3e95] GLPK v1.0.1
  [c91e804a] Gadfly v1.3.4
⌃ [87dc4568] HiGHS v1.1.3
  [7073ff75] IJulia v1.23.3
⌃ [b6b21f68] Ipopt v1.0.2
  [033835bb] JLD2 v0.4.22
  [682c06a0] JSON v0.21.3
  [0f8b85d8] JSON3 v1.9.5
⌃ [4076af6c] JuMP v1.1.1
  [67920dd8] KNITRO v0.13.0
  [ab2f91bb] OSQP v0.8.0
  [e4faabce] PProf v2.2.0
⌃ [91a5bcdd] Plots v1.29.0
  [92933f4c] ProgressMeter v1.7.2
⌃ [438e738f] PyCall v1.93.1
⌃ [295af30f] Revise v3.3.3
  [1277b4bf] ShiftedArrays v1.0.0
⌃ [90137ffa] StaticArrays v1.4.7
  [0e73dd9d] StaticModules v0.1.0
⌃ [2913bbd2] StatsBase v0.33.16
  [69024149] StringEncodings v0.3.5
⌃ [276b4fcb] WGLMakie v0.5.5
⌃ [fdbf4ff8] XLSX v0.7.10
  [ade2ca70] Dates
  [44cfe95a] Pkg v1.8.0
  [10745b16] Statistics

When I use it in this way, everything looks fine.(I just do not know why the documention is unwilling to include this):


PProf.Allocs.pprof()

Can you try it on julia 1.7.3?

I think it was renamed to simply pprof

Also, not sure why the suggestion to try 1.7.3. This was introduced in 1.8

Yes. The code in the pull request discussion that @Brian1 mentions was written when this feature was just being developed, and it was named to_pprof back then. It was changed to just pprof just a couple of weeks after that (in this commit), presumably to be consistent with the rest of PProf.jl.