summaryrefslogtreecommitdiffstats
path: root/tools/profiler/core/PowerCounters-mac-amd64.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/profiler/core/PowerCounters-mac-amd64.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/tools/profiler/core/PowerCounters-mac-amd64.cpp b/tools/profiler/core/PowerCounters-mac-amd64.cpp
index 540cee155d..c5a82694cd 100644
--- a/tools/profiler/core/PowerCounters-mac-amd64.cpp
+++ b/tools/profiler/core/PowerCounters-mac-amd64.cpp
@@ -350,13 +350,7 @@ class RAPL {
}
}
- ~RAPL() {
- free(mPkes);
- delete mPkg;
- delete mCores;
- delete mGpu;
- delete mRam;
- }
+ ~RAPL() { free(mPkes); }
void Sample() {
constexpr uint64_t kSupportedVersion = 1;
@@ -403,14 +397,14 @@ class RAPL {
PowerCounters::PowerCounters() {
// RAPL values are global, so only sample them on the parent.
- mRapl = XRE_IsParentProcess() ? new RAPL(mCounters) : nullptr;
+ if (XRE_IsParentProcess()) {
+ mRapl = mozilla::MakeUnique<RAPL>(mCounters);
+ }
}
-PowerCounters::~PowerCounters() {
- mCounters.clear();
- delete mRapl;
- mRapl = nullptr;
-}
+// This default destructor can not be defined in the header file as it depends
+// on the full definition of RAPL which lives in this file.
+PowerCounters::~PowerCounters() {}
void PowerCounters::Sample() {
if (mRapl) {