Global Metrics

path: .metrics.nom.total
old: 2.0
new: 0.0

path: .metrics.nom.functions
old: 2.0
new: 0.0

path: .metrics.halstead.purity_ratio
old: 0.3960458226993454
new: 1.747740242200621

path: .metrics.halstead.difficulty
old: 97.33333333333331
new: 8.616666666666667

path: .metrics.halstead.estimated_program_length
old: 497.03750748767845
new: 185.26046567326583

path: .metrics.halstead.length
old: 1255.0
new: 106.0

path: .metrics.halstead.N1
old: 671.0
new: 59.0

path: .metrics.halstead.n2
old: 66.0
new: 30.0

path: .metrics.halstead.time
old: 43835.61686973748
new: 271.8560786639632

path: .metrics.halstead.vocabulary
old: 88.0
new: 41.0

path: .metrics.halstead.effort
old: 789041.1036552746
new: 4893.409415951338

path: .metrics.halstead.N2
old: 584.0
new: 47.0

path: .metrics.halstead.level
old: 0.010273972602739727
new: 0.11605415860735008

path: .metrics.halstead.n1
old: 22.0
new: 11.0

path: .metrics.halstead.bugs
old: 2.8462857401862665
new: 0.09607707677451756

path: .metrics.halstead.volume
old: 8106.586681389808
new: 567.9005124895169

path: .metrics.cognitive.average
old: 5.0
new: null

path: .metrics.cognitive.sum
old: 10.0
new: 0.0

path: .metrics.nexits.average
old: 0.0
new: null

path: .metrics.cyclomatic.average
old: 4.333333333333333
new: 1.5

path: .metrics.cyclomatic.sum
old: 13.0
new: 9.0

path: .metrics.loc.cloc
old: 49.0
new: 11.0

path: .metrics.loc.ploc
old: 190.0
new: 31.0

path: .metrics.loc.blank
old: 19.0
new: 9.0

path: .metrics.loc.lloc
old: 104.0
new: 0.0

path: .metrics.loc.sloc
old: 258.0
new: 51.0

path: .metrics.nargs.sum
old: 19.0
new: 0.0

path: .metrics.nargs.average
old: 9.5
new: null

path: .metrics.mi.mi_visual_studio
old: 18.274741160424504
new: 42.25514868622386

path: .metrics.mi.mi_sei
old: 1.9570768901609057
new: 62.40890545750771

path: .metrics.mi.mi_original
old: 31.249807384325905
new: 72.2563042534428

Spaces Data

Minimal test - lines (16, 49)

path: .spaces[0].metrics.loc.lloc
old: 57.0
new: 0.0

path: .spaces[0].metrics.loc.sloc
old: 113.0
new: 34.0

path: .spaces[0].metrics.loc.cloc
old: 10.0
new: 5.0

path: .spaces[0].metrics.loc.ploc
old: 97.0
new: 22.0

path: .spaces[0].metrics.loc.blank
old: 6.0
new: 7.0

path: .spaces[0].metrics.cognitive.average
old: 6.0
new: null

path: .spaces[0].metrics.cognitive.sum
old: 6.0
new: 0.0

path: .spaces[0].metrics.halstead.bugs
old: 1.182126507400814
new: 0.0928602687391212

path: .spaces[0].metrics.halstead.length
old: 653.0
new: 98.0

path: .spaces[0].metrics.halstead.level
old: 0.019138755980861243
new: 0.10722610722610725

path: .spaces[0].metrics.halstead.difficulty
old: 52.25
new: 9.326086956521738

path: .spaces[0].metrics.halstead.time
old: 11732.898421142612
new: 258.3177690481241

path: .spaces[0].metrics.halstead.vocabulary
old: 73.0
new: 34.0

path: .spaces[0].metrics.halstead.N1
old: 356.0
new: 59.0

path: .spaces[0].metrics.halstead.n2
old: 54.0
new: 23.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 0.5995016047048322
new: 1.4499558448400158

path: .spaces[0].metrics.halstead.N2
old: 297.0
new: 39.0

path: .spaces[0].metrics.halstead.effort
old: 211192.17158056705
new: 4649.719842866233

path: .spaces[0].metrics.halstead.n1
old: 19.0
new: 11.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 391.4745478722554
new: 142.09567279432156

path: .spaces[0].metrics.halstead.volume
old: 4041.9554369486514
new: 498.5713584425332

path: .spaces[0].metrics.mi.mi_original
old: 49.623001197767294
new: 79.73187652871454

path: .spaces[0].metrics.mi.mi_sei
old: 18.83854782049047
new: 68.13017404047183

path: .spaces[0].metrics.mi.mi_visual_studio
old: 29.019298946062747
new: 46.62682837936523

path: .spaces[0].metrics.cyclomatic.average
old: 7.0
new: 1.6

path: .spaces[0].metrics.cyclomatic.sum
old: 7.0
new: 8.0

path: .spaces[0].metrics.nom.total
old: 1.0
new: 0.0

path: .spaces[0].metrics.nom.functions
old: 1.0
new: 0.0

path: .spaces[0].metrics.nexits.average
old: 0.0
new: null

path: .spaces[0].metrics.nargs.average
old: 9.0
new: null

path: .spaces[0].metrics.nargs.sum
old: 9.0
new: 0.0

Code

namespace mozilla {

class ProfilerChild;
class PProfilerChild;
class PProfilerParent;

// ChildProfilerController manages the setup and teardown of ProfilerChild.
// It's used on the main thread.
// It manages a background thread that ProfilerChild runs on.
class ChildProfilerController final {
 public:
  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChildProfilerController)

  static already_AddRefed Create(
      mozilla::ipc::Endpoint&& aEndpoint);

  [[nodiscard]] nsCString GrabShutdownProfileAndShutdown();
  void Shutdown();

 private:
  ChildProfilerController();
  ~ChildProfilerController();
  void Init(mozilla::ipc::Endpoint&& aEndpoint);
  void ShutdownAndMaybeGrabShutdownProfileFirst(nsCString* aOutShutdownProfile);

  // Called on mThread:
  void SetupProfilerChild(mozilla::ipc::Endpoint&& aEndpoint);
  void ShutdownProfilerChild(nsCString* aOutShutdownProfile);

  RefPtr mProfilerChild;  // only accessed on mThread
  RefPtr mThread;
};

}  // namespace mozilla