raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / 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	[flat|nested] 4+ messages in thread

end of thread, back to index

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

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox