Files
serenity/Userland/Utilities/nproc.cpp
Sönke Holz a6acdbf76f nproc: Use Core::System::hardware_concurrency()
This is significantly simpler than parsing JSON and using the cpuinfo
array length.

This also has the side effect of making that command work on AArch64
and RISC-V, since ProcessorInfo is not implemented on those
architectures yet.
2026-04-07 14:44:34 +02:00

20 lines
382 B
C++

/*
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/JsonObject.h>
#include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
TRY(Core::System::pledge("stdio"));
outln("{}", Core::System::hardware_concurrency());
return 0;
}