Bug 1797697 - Make names of power tracks for AMD CPUs on Windows 11 more user friendly, r=smaug.

Differential Revision: https://phabricator.services.mozilla.com/D160548
This commit is contained in:
Florian Queze 2022-10-27 22:08:11 +00:00
Родитель d82d2ab676
Коммит b5546684d4
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -74,7 +74,16 @@ class PowerMeterChannel final : public BaseProfilerCount {
mLabel = "Power: DRAM"; mLabel = "Power: DRAM";
mDescription = mChannelName.get(); mDescription = mChannelName.get();
} else { } else {
mLabel = mChannelName.get(); unsigned int coreId;
if (sscanf(mChannelName.get(), "RAPL_Package0_Core%u_CORE", &coreId) ==
1) {
mLabelString = "Power: CPU core ";
mLabelString.AppendInt(coreId);
mLabel = mLabelString.get();
mDescription = mChannelName.get();
} else {
mLabel = mChannelName.get();
}
} }
} }
@ -106,6 +115,10 @@ class PowerMeterChannel final : public BaseProfilerCount {
private: private:
int64_t mCounter; int64_t mCounter;
nsCString mChannelName; nsCString mChannelName;
// Used as a storage when the label can not be a literal string.
nsCString mLabelString;
ULONGLONG mPreviousValue; ULONGLONG mPreviousValue;
ULONGLONG mPreviousTime; ULONGLONG mPreviousTime;
bool mIsSampleNew; bool mIsSampleNew;