Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4460 - in trunk: auto src/os/unix

Anonymous User
February 10, 2012 06:26AM
Author: vbart
Date: 2012-02-10 11:24:19 +0000 (Fri, 10 Feb 2012)
New Revision: 4460

Modified:
trunk/auto/unix
trunk/src/os/unix/ngx_posix_init.c
Log:
Added ngx_ncpu detection for most *nix platforms.

This inaccurate detection by using sysconf(_SC_NPROCESSORS_ONLN) can improve
usage of the mutex lock optimization on multicore systems.


Modified: trunk/auto/unix
===================================================================
--- trunk/auto/unix 2012-02-10 10:48:58 UTC (rev 4459)
+++ trunk/auto/unix 2012-02-10 11:24:19 UTC (rev 4460)
@@ -721,3 +721,13 @@
ngx_feature_libs=
ngx_feature_test="struct dirent dir; dir.d_type = DT_REG"
. auto/feature
+
+
+ngx_feature="sysconf(_SC_NPROCESSORS_ONLN)"
+ngx_feature_name="NGX_HAVE_SC_NPROCESSORS_ONLN"
+ngx_feature_run=no
+ngx_feature_incs=
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
+. auto/feature

Modified: trunk/src/os/unix/ngx_posix_init.c
===================================================================
--- trunk/src/os/unix/ngx_posix_init.c 2012-02-10 10:48:58 UTC (rev 4459)
+++ trunk/src/os/unix/ngx_posix_init.c 2012-02-10 11:24:19 UTC (rev 4460)
@@ -47,7 +47,13 @@

for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }

+#if (NGX_HAVE_SC_NPROCESSORS_ONLN)
if (ngx_ncpu == 0) {
+ ngx_ncpu = sysconf(_SC_NPROCESSORS_ONLN);
+ }
+#endif
+
+ if (ngx_ncpu < 1) {
ngx_ncpu = 1;
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4460 - in trunk: auto src/os/unix

Anonymous User 1344 February 10, 2012 06:26AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready