raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH 1/3] raindrops: favor configured processor count over online count
@ 2013-04-11 23:28 Eric Wong
  2013-04-11 23:28 ` [PATCH 2/3] watcher: set Content-Type via assignment Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2013-04-11 23:28 UTC (permalink / raw)
  To: raindrops

The runnable CPUs of a process may change over the lifetime of
the process.  So favor the count of configured processor count
since that is more likely to be stable.

We do not currently do not have special handling for
hot-plugging/removal of CPUs on systems that may load raindrops
in a single CPU state.
---
 ext/raindrops/raindrops.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ext/raindrops/raindrops.c b/ext/raindrops/raindrops.c
index 6cc0d12..65c16e7 100644
--- a/ext/raindrops/raindrops.c
+++ b/ext/raindrops/raindrops.c
@@ -326,11 +326,13 @@ void Init_raindrops_linux_inet_diag(void);
 void Init_raindrops_linux_tcp_info(void);
 #endif
 
-#ifndef _SC_NPROCESSORS_ONLN
-#  ifdef _SC_NPROC_ONLN
-#    define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
+#ifndef _SC_NPROCESSORS_CONF
+#  if defined _SC_NPROCESSORS_ONLN
+#    define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN
+#  elif defined _SC_NPROC_ONLN
+#    define _SC_NPROCESSORS_CONF _SC_NPROC_ONLN
 #  elif defined _SC_CRAY_NCPU
-#    define _SC_NPROCESSORS_ONLN _SC_CRAY_NCPU
+#    define _SC_NPROCESSORS_CONF _SC_CRAY_NCPU
 #  endif
 #endif
 
@@ -359,8 +361,8 @@ void Init_raindrops_ext(void)
 	VALUE cRaindrops = rb_define_class("Raindrops", rb_cObject);
 	long tmp = 2;
 
-#ifdef _SC_NPROCESSORS_ONLN
-	tmp = sysconf(_SC_NPROCESSORS_ONLN);
+#ifdef _SC_NPROCESSORS_CONF
+	tmp = sysconf(_SC_NPROCESSORS_CONF);
 #endif
 	/* no point in padding on single CPU machines */
 	if (tmp == 1)
-- 
1.8.2.279.g631bc94



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-11 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 23:28 [PATCH 1/3] raindrops: favor configured processor count over online count Eric Wong
2013-04-11 23:28 ` [PATCH 2/3] watcher: set Content-Type via assignment Eric Wong
2013-04-11 23:28 ` [PATCH 3/3] Linux::TCP_Info: implement #get! instance method Eric Wong
2013-04-11 23:30 ` [PATCH 1/3] raindrops: favor configured processor count over online count Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/raindrops.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).