Where is torch::autograd::profiler?

I am using libtorch, c++ frontend, downloaded from the main page of https://pytorch.org/ and trying to profile layer by layer.

I’ve learn that in python i can use torch.autograd.profiler.profile. And i’ve read some website, including Access profiler from cpp by zdevito · Pull Request #16580 · pytorch/pytorch · GitHub and Caffe2 - C++ API: torch::autograd::profiler::RecordProfile Struct Reference

But when i use CLion to construct my code, use torch::autograd::profiler::RecordProfile , it report an error that

no member named ‘profiler’ in namespace 'torch::autograd

I turned to Library API — PyTorch main documentation, and cannot find something about profiler, so how should i do to use the profiler in my project?

You can include torch/csrc/autograd/profiler.h. I’m not entirely sure of the stability guarantee of the things in torch/csrc/, but it is in the distribution.

Best regards

Thomas

Thanks for you reply, but now i have some question about the fields that displayed by profiler, since they are different from the python document.

{
  "name": "size",
  "ph": "X",
  "ts": 236152.000000,
  "dur": 1.000000,
  "tid": 0,
  "pid": "CPU Functions",
  "args": {}
},

What’s the meaning of ph, ts, dur and tid, and how should i explain their value?