diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-12-27 01:50:21 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-02-15 20:55:53 +0100 |
commit | ee7cd9a3a14415722c1086a3bde02c2e4d0fd0eb (patch) | |
tree | d9d653e44615c17cc3b33d47997ee0cc4ff7009a /core | |
parent | 171021145d49ffdda9110869d35ee63a946af9f8 (diff) | |
download | redot-engine-ee7cd9a3a14415722c1086a3bde02c2e4d0fd0eb.tar.gz |
Add an `OS.get_processor_name()` method
This method can be used to get the CPU model name.
It can be used in conjunction with
`RenderingServer.get_video_adapter_name()` and
`RenderingServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
Diffstat (limited to 'core')
-rw-r--r-- | core/core_bind.cpp | 5 | ||||
-rw-r--r-- | core/core_bind.h | 1 | ||||
-rw-r--r-- | core/os/os.cpp | 4 | ||||
-rw-r--r-- | core/os/os.h | 1 |
4 files changed, 11 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index b31cc18b7a..810284d5d0 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -362,6 +362,10 @@ int OS::get_processor_count() const { return ::OS::get_singleton()->get_processor_count(); } +String OS::get_processor_name() const { + return ::OS::get_singleton()->get_processor_name(); +} + bool OS::is_stdout_verbose() const { return ::OS::get_singleton()->is_stdout_verbose(); } @@ -554,6 +558,7 @@ void OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_low_processor_usage_mode_sleep_usec"), &OS::get_low_processor_usage_mode_sleep_usec); ClassDB::bind_method(D_METHOD("get_processor_count"), &OS::get_processor_count); + ClassDB::bind_method(D_METHOD("get_processor_name"), &OS::get_processor_name); ClassDB::bind_method(D_METHOD("get_executable_path"), &OS::get_executable_path); ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "output", "read_stderr", "open_console"), &OS::execute, DEFVAL(Array()), DEFVAL(false), DEFVAL(false)); diff --git a/core/core_bind.h b/core/core_bind.h index 21a1fc2077..1ed243206b 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -218,6 +218,7 @@ public: bool is_stdout_verbose() const; int get_processor_count() const; + String get_processor_name() const; enum SystemDir { SYSTEM_DIR_DESKTOP, diff --git a/core/os/os.cpp b/core/os/os.cpp index 0032e8e4bc..9558a6978e 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -358,6 +358,10 @@ int OS::get_processor_count() const { return 1; } +String OS::get_processor_name() const { + return ""; +} + bool OS::can_use_threads() const { #ifdef NO_THREADS return false; diff --git a/core/os/os.h b/core/os/os.h index 188900a070..808d704b3d 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -302,6 +302,7 @@ public: virtual void set_exit_code(int p_code); virtual int get_processor_count() const; + virtual String get_processor_name() const; virtual int get_default_thread_pool_size() const { return get_processor_count(); } virtual String get_unique_id() const; |