mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
This will be needed to collect statistics from processes that do not have anything to do with LibWebView. The ProcessInfo structure must be virtual to allow callers to add application-specific information.
32 lines
701 B
C++
32 lines
701 B
C++
/*
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/TypeCasts.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibCore/Platform/ProcessInfo.h>
|
|
|
|
namespace Core::Platform {
|
|
|
|
struct ProcessStatistics {
|
|
template<typename ProcessInfoType, typename Callback>
|
|
void for_each_process(Callback&& callback)
|
|
{
|
|
for (auto& process : processes)
|
|
callback(verify_cast<ProcessInfoType>(*process));
|
|
}
|
|
|
|
u64 total_time_scheduled { 0 };
|
|
Vector<NonnullOwnPtr<ProcessInfo>> processes;
|
|
};
|
|
|
|
ErrorOr<void> update_process_statistics(ProcessStatistics&);
|
|
|
|
}
|