add get core count

This commit is contained in:
Colin Davidson
2023-01-05 01:06:55 -08:00
parent 782f1b4718
commit 944396128b
5 changed files with 97 additions and 1 deletions
+5
View File
@@ -404,6 +404,7 @@ foreign libc {
@(link_name="__errno_location") __errno_location :: proc() -> ^int ---
@(link_name="getpagesize") _unix_getpagesize :: proc() -> c.int ---
@(link_name="get_nprocs") _unix_get_nprocs :: proc() -> c.int ---
@(link_name="fdopendir") _unix_fdopendir :: proc(fd: Handle) -> Dir ---
@(link_name="closedir") _unix_closedir :: proc(dirp: Dir) -> c.int ---
@(link_name="rewinddir") _unix_rewinddir :: proc(dirp: Dir) ---
@@ -878,6 +879,10 @@ get_page_size :: proc() -> int {
return page_size
}
get_processor_thread_count :: proc() -> int {
thread_count := int(_unix_get_nprocs())
return thread_count
}
_alloc_command_line_arguments :: proc() -> []string {
res := make([]string, len(runtime.args__))