-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f54955
commit 44d0abb
Showing
8 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
core/src/linuxMain/kotlin/org/jetbrains/litmuskt/NativeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.jetbrains.litmuskt | ||
|
||
import platform.posix.sysconf | ||
import platform.posix._SC_NPROCESSORS_ONLN | ||
|
||
actual fun cpuCount(): Int = sysconf(_SC_NPROCESSORS_ONLN).toInt() |
6 changes: 6 additions & 0 deletions
6
core/src/macosMain/kotlin/org/jetbrains/litmuskt/NativeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.jetbrains.litmuskt | ||
|
||
import platform.posix.sysconf | ||
import platform.posix._SC_NPROCESSORS_ONLN | ||
|
||
actual fun cpuCount(): Int = sysconf(_SC_NPROCESSORS_ONLN).toInt() |
17 changes: 17 additions & 0 deletions
17
core/src/mingwMain/kotlin/org/jetbrains/litmuskt/NativeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.jetbrains.litmuskt | ||
|
||
import kotlinx.cinterop.ExperimentalForeignApi | ||
import kotlinx.cinterop.alloc | ||
import kotlinx.cinterop.memScoped | ||
import kotlinx.cinterop.ptr | ||
import platform.windows.GetSystemInfo | ||
import platform.windows.SYSTEM_INFO | ||
|
||
actual val affinityManager: AffinityManager? = null | ||
|
||
@OptIn(ExperimentalForeignApi::class) | ||
actual fun cpuCount(): Int = memScoped { | ||
val systemInfo = alloc<SYSTEM_INFO>() | ||
GetSystemInfo(systemInfo.ptr) | ||
systemInfo.dwNumberOfProcessors.toInt() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters