JSMetrics.h 778 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. public:
  20. /// Construct.
  21. JSMetrics(Context* context, JSVM* vm);
  22. /// Destruct.
  23. virtual ~JSMetrics();
  24. void Capture();
  25. void Dump();
  26. void DumpJSComponents();
  27. private:
  28. WeakPtr<JSVM> vm_;
  29. // Object
  30. HashMap<StringHash, ObjectMetric> objectMetrics_;
  31. };
  32. }