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 удалений

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

@ -73,10 +73,19 @@ class PowerMeterChannel final : public BaseProfilerCount {
} else if (mChannelName.Equals("RAPL_Package0_DRAM")) {
mLabel = "Power: DRAM";
mDescription = mChannelName.get();
} else {
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();
}
}
}
CountSample Sample() override {
CountSample result;
@ -106,6 +115,10 @@ class PowerMeterChannel final : public BaseProfilerCount {
private:
int64_t mCounter;
nsCString mChannelName;
// Used as a storage when the label can not be a literal string.
nsCString mLabelString;
ULONGLONG mPreviousValue;
ULONGLONG mPreviousTime;
bool mIsSampleNew;