ProcessInfo.h 693 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Types.h>
  8. #if defined(AK_OS_MACH)
  9. # include <LibCore/MachPort.h>
  10. #endif
  11. namespace Core::Platform {
  12. struct ProcessInfo {
  13. explicit ProcessInfo(pid_t pid)
  14. : pid(pid)
  15. {
  16. }
  17. virtual ~ProcessInfo() = default;
  18. pid_t pid { 0 };
  19. u64 memory_usage_bytes { 0 };
  20. float cpu_percent { 0.0f };
  21. u64 time_spent_in_process { 0 };
  22. #if defined(AK_OS_MACH)
  23. ProcessInfo(pid_t pid, Core::MachPort&& port)
  24. : pid(pid)
  25. , child_task_port(move(port))
  26. {
  27. }
  28. Core::MachPort child_task_port;
  29. #endif
  30. };
  31. }