JSMetrics.h 941 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #pragma once
  5. #include <Atomic/Core/Context.h>
  6. #include <Atomic/Core/Object.h>
  7. #include <Atomic/Container/List.h>
  8. namespace Atomic
  9. {
  10. class JSVM;
  11. class JSMetrics : public Object
  12. {
  13. OBJECT(JSMetrics);
  14. struct ObjectMetric
  15. {
  16. String classname;
  17. int count;
  18. };
  19. struct NodeMetric
  20. {
  21. String name;
  22. int count;
  23. };
  24. public:
  25. /// Construct.
  26. JSMetrics(Context* context, JSVM* vm);
  27. /// Destruct.
  28. virtual ~JSMetrics();
  29. void Capture();
  30. void Dump();
  31. void DumpNodes();
  32. void DumpJSComponents();
  33. private:
  34. WeakPtr<JSVM> vm_;
  35. // Object
  36. HashMap<StringHash, ObjectMetric> objectMetrics_;
  37. // Nodes
  38. HashMap<StringHash, NodeMetric> nodeMetrics_;
  39. };
  40. }