[wing] Add wing_get_n_processors
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [wing] Add wing_get_n_processors
- Date: Wed, 29 Mar 2017 15:50:46 +0000 (UTC)
commit ba4a7edf5fc23bbcec6325b7131d208bff9830b1
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Wed Mar 29 11:16:02 2017 +0200
Add wing_get_n_processors
wing/wingutils.c | 12 ++++++++++++
wing/wingutils.h | 3 +++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/wing/wingutils.c b/wing/wingutils.c
index 17d8155..8700ed7 100644
--- a/wing/wingutils.c
+++ b/wing/wingutils.c
@@ -155,3 +155,15 @@ wing_get_process_times (gint64 *current_user_time,
return TRUE;
}
+
+guint
+wing_get_n_processors (void)
+{
+ int n;
+ SYSTEM_INFO sysinfo;
+
+ GetSystemInfo (&sysinfo);
+ n = sysinfo.dwNumberOfProcessors;
+
+ return n > 1 ? (guint)n : 1;
+}
diff --git a/wing/wingutils.h b/wing/wingutils.h
index 4f27050..a25b207 100644
--- a/wing/wingutils.h
+++ b/wing/wingutils.h
@@ -44,6 +44,9 @@ WING_AVAILABLE_IN_ALL
gboolean wing_get_process_times (gint64 *current_user_time,
gint64 *current_system_time);
+WING_AVAILABLE_IN_ALL
+guint wing_get_n_processors (void);
+
G_END_DECLS
#endif /* WING_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]