Why GetOverviewText in ProfilerDriver always returns 0?

Problem occurs in Unity 2022.2.5f1.
Referring to the issue DrawCall count · Issue #7 · steve3003/unity-profiler-data-exporter · GitHub
and the source code in https://github.com/wyhwow/PerformanceAnalysis/blob/master/Assets/Editor/DataStatistics.cs

I tried the following code,

PlayerSettings.graphicsJobs = false;
ProfilerDriver.enabled = true;
ProfilerDriver.profileGPU = true;
ProfilerDriver.SetAreaEnabled(ProfilerArea.Memory, true);

Debug.LogError(ProfilerDriver.GetOverviewText(ProfilerArea.Memory, ProfilerDriver.lastFrameIndex));

this code is expected to log the memory information in Profiling, but in the Play Mode, I get “Used Total: 0 B Unity: 0 B Mono: 0 B GfxDriver: 0 B Audio: 0 B Video: 0 B Profiler: 0 B
Reserved Total: 0 B Unity: 0 B Mono: 0 B GfxDriver: 0 B Audio: 0 B Video: 0 B Profiler: 0 B
Total System Memory Usage: 0 B”.

I tried lots of times, and always got 0.
Has this API been discontinued for maintenance?

Yeah, it has been deprecated and was technically never meant to be relied upon, hence the UnityEditorInternal namespace. It is still there for compatibility reasons with older profiler data but newer Unity versions should rely on ProfilerCounter values, which can be retrieved from the Profiler data via

var data = ProfilerDriver.GetRawFrameDataView(ProfilerData.lastFrameIndex, 0);
var id = data.GetMarkerId(“Total Used Memory”);
var value = data.GetCounterValueAsLong(id);

Or at runtime via ProfileRecorder.StartNew(ProfilerCategory.Memory, “Total Used Memory”)

See the module documentation (Unity - Manual: Memory Profiler module) for the names of the counter and the documentation for the rest of the functions I mentioned for code examples.