Changeset 4506:14f8e8a0cc77 in nginx


Ignore:
Timestamp:
03/05/12 12:10:09 (8 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
stable-1.0
Phase:
public
Convert:
svn:c3fe7df1-7212-e011-8a91-001109144009/branches/stable-1.0@4507
Message:

Merge of r4460: 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.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • auto/unix

    r4450 r4506  
    708708ngx_feature_test="struct dirent  dir; dir.d_type = DT_REG"
    709709. auto/feature
     710
     711
     712ngx_feature="sysconf(_SC_NPROCESSORS_ONLN)"
     713ngx_feature_name="NGX_HAVE_SC_NPROCESSORS_ONLN"
     714ngx_feature_run=no
     715ngx_feature_incs=
     716ngx_feature_path=
     717ngx_feature_libs=
     718ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
     719. auto/feature
  • src/os/unix/ngx_posix_init.c

    r4412 r4459  
    4848    for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }
    4949
     50#if (NGX_HAVE_SC_NPROCESSORS_ONLN)
    5051    if (ngx_ncpu == 0) {
     52        ngx_ncpu = sysconf(_SC_NPROCESSORS_ONLN);
     53    }
     54#endif
     55
     56    if (ngx_ncpu < 1) {
    5157        ngx_ncpu = 1;
    5258    }
Note: See TracChangeset for help on using the changeset viewer.