Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ize gpr_thread as grpc_core::Thread, make it 2-phase init (construct/Start) #14459

Merged
merged 28 commits into from
Mar 3, 2018

Conversation

vjpai
Copy link
Member

@vjpai vjpai commented Feb 20, 2018

Builds on #14439 .

@vjpai vjpai added this to Not yet started in Core conversion to idiomatic C++ via automation Feb 20, 2018
@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  [NEW] +1.00Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.00Ki  [NEW]
      [NEW]    +497 grpc_core::Thread::Thread                                                               +497  [NEW]
      [NEW]    +200 grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*)::{lambda(void*    +200  [NEW]
      [NEW]    +106 grpc_core::Thread::AwaitAll                                                             +106  [NEW]
      [NEW]     +92 grpc_core::(anonymous namespace)::dec_thd_count() [clone .part.1]                        +92  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +49 [Unmapped]                                                                               +49  [NEW]
      [NEW]     +27 grpc_core::Thread::Join                                                                  +27  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
  +3.5%    +424 src/core/lib/iomgr/ev_poll_posix.cc                                                     +424  +3.5%
      [NEW]    +207 cache_harvest_locked                                                                    +207  [NEW]
      [NEW]    +169 init_result(poll_args*) [clone .constprop.17]                                           +169  [NEW]
       +31%    +159 run_poll                                                                                +159   +31%
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.19]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      +0.9%     +14 cvfd_poll                                                                                +14  +0.9%
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
   +14%    +416 src/core/lib/iomgr/executor.cc                                                          +416   +14%
       +41%    +231 grpc_executor_set_threading                                                             +231   +41%
       +14%    +181 executor_push                                                                           +181   +14%
      [NEW]    +166 run_closures(grpc_closure_list) [clone .isra.5]                                         +166  [NEW]
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
   +48%    +147 src/core/tsi/alts_transport_security.cc                                                 +147   +48%
      [NEW]     +93 alts_shared_resource::~alts_shared_resource                                              +93  [NEW]
      [NEW]     +54 _GLOBAL__sub_I_alts_transport_security.cc                                                +54  [NEW]
  +1.3%     +32 src/core/lib/iomgr/timer_manager.cc                                                      +32  +1.3%
       +81%     +83 gc_completed_threads                                                                     +83   +81%

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

 -+-+-+-+-+-+-+ MIXED                                                                                +-+-+-+-+-+-+-
  -0.1%    -401 [None]                                                                               +9.96Ki  +0.2%
       +80%     +96 g_alts_resource                                                                            0  [ = ]
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
      [DEL]     -48 g_cv                                                                                       0  [ = ]
      -3.4%     -40 [None]                                                                                     0  [ = ]
     -20.0%     -40 g_mu                                                                                       0  [ = ]
     -50.0%      -4 g_thread_count                                                                             0  [ = ]
      [DEL]      -4 g_awaiting_threads                                                                         0  [ = ]

  +0.0%    +512 TOTAL                                                                                +10.9Ki  +0.2%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  [NEW] +1.00Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.00Ki  [NEW]
      [NEW]    +497 grpc_core::Thread::Thread                                                               +497  [NEW]
      [NEW]    +200 grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*)::{lambda(void*    +200  [NEW]
      [NEW]    +106 grpc_core::Thread::AwaitAll                                                             +106  [NEW]
      [NEW]     +92 grpc_core::(anonymous namespace)::dec_thd_count() [clone .part.1]                        +92  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +49 [Unmapped]                                                                               +49  [NEW]
      [NEW]     +27 grpc_core::Thread::Join                                                                  +27  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
  +3.5%    +424 src/core/lib/iomgr/ev_poll_posix.cc                                                     +424  +3.5%
      [NEW]    +207 cache_harvest_locked                                                                    +207  [NEW]
      [NEW]    +169 init_result(poll_args*) [clone .constprop.17]                                           +169  [NEW]
       +31%    +159 run_poll                                                                                +159   +31%
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.19]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      +0.9%     +14 cvfd_poll                                                                                +14  +0.9%
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
   +14%    +416 src/core/lib/iomgr/executor.cc                                                          +416   +14%
       +41%    +231 grpc_executor_set_threading                                                             +231   +41%
       +14%    +181 executor_push                                                                           +181   +14%
      [NEW]    +166 run_closures(grpc_closure_list) [clone .isra.5]                                         +166  [NEW]
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
   +48%    +147 src/core/tsi/alts_transport_security.cc                                                 +147   +48%
      [NEW]     +93 alts_shared_resource::~alts_shared_resource                                              +93  [NEW]
      [NEW]     +54 _GLOBAL__sub_I_alts_transport_security.cc                                                +54  [NEW]
  +1.3%     +32 src/core/lib/iomgr/timer_manager.cc                                                      +32  +1.3%
       +81%     +83 gc_completed_threads                                                                     +83   +81%

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

 -+-+-+-+-+-+-+ MIXED                                                                                +-+-+-+-+-+-+-
  -0.1%    -401 [None]                                                                               +9.96Ki  +0.2%
       +80%     +96 g_alts_resource                                                                            0  [ = ]
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
      [DEL]     -48 g_cv                                                                                       0  [ = ]
      -3.4%     -40 [None]                                                                                     0  [ = ]
     -20.0%     -40 g_mu                                                                                       0  [ = ]
     -50.0%      -4 g_thread_count                                                                             0  [ = ]
      [DEL]      -4 g_awaiting_threads                                                                         0  [ = ]

  +0.0%    +512 TOTAL                                                                                +10.9Ki  +0.2%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  [NEW] +1.00Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.00Ki  [NEW]
      [NEW]    +497 grpc_core::Thread::Thread                                                               +497  [NEW]
      [NEW]    +200 grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*)::{lambda(void*    +200  [NEW]
      [NEW]    +106 grpc_core::Thread::AwaitAll                                                             +106  [NEW]
      [NEW]     +92 grpc_core::(anonymous namespace)::dec_thd_count() [clone .part.1]                        +92  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +49 [Unmapped]                                                                               +49  [NEW]
      [NEW]     +27 grpc_core::Thread::Join                                                                  +27  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
  +3.5%    +424 src/core/lib/iomgr/ev_poll_posix.cc                                                     +424  +3.5%
      [NEW]    +207 cache_harvest_locked                                                                    +207  [NEW]
      [NEW]    +169 init_result(poll_args*) [clone .constprop.17]                                           +169  [NEW]
       +31%    +159 run_poll                                                                                +159   +31%
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.19]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      +0.9%     +14 cvfd_poll                                                                                +14  +0.9%
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
   +14%    +416 src/core/lib/iomgr/executor.cc                                                          +416   +14%
       +41%    +231 grpc_executor_set_threading                                                             +231   +41%
       +14%    +181 executor_push                                                                           +181   +14%
      [NEW]    +166 run_closures(grpc_closure_list) [clone .isra.5]                                         +166  [NEW]
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
   +48%    +147 src/core/tsi/alts_transport_security.cc                                                 +147   +48%
      [NEW]     +93 alts_shared_resource::~alts_shared_resource                                              +93  [NEW]
      [NEW]     +54 _GLOBAL__sub_I_alts_transport_security.cc                                                +54  [NEW]
  +1.3%     +32 src/core/lib/iomgr/timer_manager.cc                                                      +32  +1.3%
       +81%     +83 gc_completed_threads                                                                     +83   +81%

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

 -+-+-+-+-+-+-+ MIXED                                                                                +-+-+-+-+-+-+-
  -0.1%    -401 [None]                                                                               +8.48Ki  +0.1%
       +80%     +96 g_alts_resource                                                                            0  [ = ]
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
      [DEL]     -48 g_cv                                                                                       0  [ = ]
      -3.4%     -40 [None]                                                                                     0  [ = ]
     -20.0%     -40 g_mu                                                                                       0  [ = ]
     -50.0%      -4 g_thread_count                                                                             0  [ = ]
      [DEL]      -4 g_awaiting_threads                                                                         0  [ = ]

  +0.0%    +512 TOTAL                                                                                +9.37Ki  +0.1%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

[trickle] No significant performance differences

2 similar comments
@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

[trickle] No significant performance differences

@vjpai vjpai moved this from Not yet started to In progress in Core conversion to idiomatic C++ Feb 20, 2018
@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

2 similar comments
@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  [NEW] +1.00Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.00Ki  [NEW]
      [NEW]    +497 grpc_core::Thread::Thread                                                               +497  [NEW]
      [NEW]    +200 grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*)::{lambda(void*    +200  [NEW]
      [NEW]    +106 grpc_core::Thread::AwaitAll                                                             +106  [NEW]
      [NEW]     +92 grpc_core::(anonymous namespace)::dec_thd_count() [clone .part.1]                        +92  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +49 [Unmapped]                                                                               +49  [NEW]
      [NEW]     +27 grpc_core::Thread::Join                                                                  +27  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
  +3.5%    +424 src/core/lib/iomgr/ev_poll_posix.cc                                                     +424  +3.5%
      [NEW]    +207 cache_harvest_locked                                                                    +207  [NEW]
      [NEW]    +169 init_result(poll_args*) [clone .constprop.17]                                           +169  [NEW]
       +31%    +159 run_poll                                                                                +159   +31%
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.19]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      +0.9%     +14 cvfd_poll                                                                                +14  +0.9%
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
   +14%    +416 src/core/lib/iomgr/executor.cc                                                          +416   +14%
       +41%    +231 grpc_executor_set_threading                                                             +231   +41%
       +14%    +181 executor_push                                                                           +181   +14%
      [NEW]    +166 run_closures(grpc_closure_list) [clone .isra.5]                                         +166  [NEW]
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
   +48%    +147 src/core/tsi/alts_transport_security.cc                                                 +147   +48%
      [NEW]     +93 alts_shared_resource::~alts_shared_resource                                              +93  [NEW]
      [NEW]     +54 _GLOBAL__sub_I_alts_transport_security.cc                                                +54  [NEW]
  +1.3%     +32 src/core/lib/iomgr/timer_manager.cc                                                      +32  +1.3%
       +81%     +83 gc_completed_threads                                                                     +83   +81%

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

 -+-+-+-+-+-+-+ MIXED                                                                                +-+-+-+-+-+-+-
  -0.1%    -401 [None]                                                                               +8.48Ki  +0.1%
       +80%     +96 g_alts_resource                                                                            0  [ = ]
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
      [DEL]     -48 g_cv                                                                                       0  [ = ]
      -3.4%     -40 [None]                                                                                     0  [ = ]
     -20.0%     -40 g_mu                                                                                       0  [ = ]
     -50.0%      -4 g_thread_count                                                                             0  [ = ]
      [DEL]      -4 g_awaiting_threads                                                                         0  [ = ]

  +0.0%    +512 TOTAL                                                                                +9.37Ki  +0.1%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



1 similar comment
@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  [NEW] +1.00Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.00Ki  [NEW]
      [NEW]    +497 grpc_core::Thread::Thread                                                               +497  [NEW]
      [NEW]    +200 grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*)::{lambda(void*    +200  [NEW]
      [NEW]    +106 grpc_core::Thread::AwaitAll                                                             +106  [NEW]
      [NEW]     +92 grpc_core::(anonymous namespace)::dec_thd_count() [clone .part.1]                        +92  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +49 [Unmapped]                                                                               +49  [NEW]
      [NEW]     +27 grpc_core::Thread::Join                                                                  +27  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
  +3.5%    +424 src/core/lib/iomgr/ev_poll_posix.cc                                                     +424  +3.5%
      [NEW]    +207 cache_harvest_locked                                                                    +207  [NEW]
      [NEW]    +169 init_result(poll_args*) [clone .constprop.17]                                           +169  [NEW]
       +31%    +159 run_poll                                                                                +159   +31%
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.19]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      +0.9%     +14 cvfd_poll                                                                                +14  +0.9%
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
   +14%    +416 src/core/lib/iomgr/executor.cc                                                          +416   +14%
       +41%    +231 grpc_executor_set_threading                                                             +231   +41%
       +14%    +181 executor_push                                                                           +181   +14%
      [NEW]    +166 run_closures(grpc_closure_list) [clone .isra.5]                                         +166  [NEW]
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
   +48%    +147 src/core/tsi/alts_transport_security.cc                                                 +147   +48%
      [NEW]     +93 alts_shared_resource::~alts_shared_resource                                              +93  [NEW]
      [NEW]     +54 _GLOBAL__sub_I_alts_transport_security.cc                                                +54  [NEW]
  +1.3%     +32 src/core/lib/iomgr/timer_manager.cc                                                      +32  +1.3%
       +81%     +83 gc_completed_threads                                                                     +83   +81%

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

 -+-+-+-+-+-+-+ MIXED                                                                                +-+-+-+-+-+-+-
  -0.1%    -401 [None]                                                                               +8.48Ki  +0.1%
       +80%     +96 g_alts_resource                                                                            0  [ = ]
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
      [DEL]     -48 g_cv                                                                                       0  [ = ]
      -3.4%     -40 [None]                                                                                     0  [ = ]
     -20.0%     -40 g_mu                                                                                       0  [ = ]
     -50.0%      -4 g_thread_count                                                                             0  [ = ]
      [DEL]      -4 g_awaiting_threads                                                                         0  [ = ]

  +0.0%    +512 TOTAL                                                                                +9.37Ki  +0.1%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link

[trickle] No significant performance differences

1 similar comment
@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

[microbenchmarks] Performance differences noted:
Benchmark                                                              cpu_time    real_time
---------------------------------------------------------------------  ----------  -----------
BM_PumpStreamServerToClient<InProcess>/262144                          +6%         +6%
BM_StreamingPingPong<MinInProcess, NoOpMutator, NoOpMutator>/262144/1  -5%         -5%
BM_UnaryPingPong<InProcess, NoOpMutator, NoOpMutator>/0/2097152        +5%         +5%
BM_UnaryPingPong<InProcess, NoOpMutator, NoOpMutator>/0/262144         +5%         +5%

@grpc-testing
Copy link

[microbenchmarks] Performance differences noted:
Benchmark                                                                                 cpu_time    real_time
----------------------------------------------------------------------------------------  ----------  -----------
BM_PumpStreamClientToServer<InProcess>/32768                                              +4%         +4%
BM_StreamingPingPongWithCoalescingApi<MinInProcess, NoOpMutator, NoOpMutator>/262144/1/0  -5%         -5%

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +0.0%    +162 [None]                                                                                +111Ki  +1.7%
      +0.0%    +114 [Unmapped]                                                                            +111Ki  +1.7%
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +48 vtable for grpc_core::(anonymous namespace)::ThreadInternalsPosix                        +48  [NEW]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
      +6.7%      +8 g_alts_resource                                                                            0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
  [NEW] +1.30Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.30Ki  [NEW]
      [NEW]    +616 grpc_core::Thread::Thread                                                               +616  [NEW]
      [NEW]    +275 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char co    +275  [NEW]
      [NEW]    +179 grpc_core::Thread::AwaitAll                                                             +179  [NEW]
      [NEW]     +74 [Unmapped]                                                                               +74  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +48 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Start                            +48  [NEW]
      [NEW]     +38 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +38  [NEW]
      [NEW]     +34 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +34  [NEW]
      [NEW]     +11 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Join                             +11  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
   +28%    +816 src/core/lib/iomgr/executor.cc                                                          +816   +28%
       +88%    +501 grpc_executor_set_threading                                                             +501   +88%
       +24%    +311 executor_push                                                                           +311   +24%
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
  +6.3%    +771 src/core/lib/iomgr/ev_poll_posix.cc                                                     +771  +6.3%
      [NEW]    +331 cache_harvest_locked                                                                    +331  [NEW]
       +13%    +205 cvfd_poll                                                                               +205   +13%
       +34%    +174 run_poll                                                                                +174   +34%
      [NEW]    +169 init_result(poll_args*) [clone .constprop.19]                                           +169  [NEW]
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.21]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]
   +13%    +320 src/core/lib/iomgr/timer_manager.cc                                                     +320   +13%
       +67%    +174 start_timer_thread_and_unlock                                                           +174   +67%
      +158%    +163 gc_completed_threads                                                                    +163  +158%
   +96%    +293 src/core/tsi/alts_transport_security.cc                                                 +293   +96%
      +118%    +190 grpc_tsi_alts_shutdown                                                                  +190  +118%
      [NEW]     +56 alts_shared_resource::~alts_shared_resource                                              +56  [NEW]
      [NEW]     +47 _GLOBAL__sub_I_alts_transport_security.cc                                                +47  [NEW]

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

  +0.2% +2.50Ki TOTAL                                                                                 +114Ki  +1.5%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]    +112  +0.0%

  [ = ]       0 TOTAL     +112  +0.0%



@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

[microbenchmarks] Performance differences noted:
Benchmark                    cpu_time    real_time
---------------------------  ----------  -----------
BM_MetadataRefUnrefExternal  -5%         -5%
BM_MetadataRefUnrefStatic    -20%        -20%

@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

@vjpai
Copy link
Member Author

vjpai commented Mar 1, 2018

Tests were all green but I decided to remerge master to avoid any chance of divergence

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +0.0%    +162 [None]                                                                                +111Ki  +1.7%
      +0.0%    +114 [Unmapped]                                                                            +111Ki  +1.7%
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +48 vtable for grpc_core::(anonymous namespace)::ThreadInternalsPosix                        +48  [NEW]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
      +6.7%      +8 g_alts_resource                                                                            0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
  [NEW] +1.30Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.30Ki  [NEW]
      [NEW]    +616 grpc_core::Thread::Thread                                                               +616  [NEW]
      [NEW]    +275 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char co    +275  [NEW]
      [NEW]    +179 grpc_core::Thread::AwaitAll                                                             +179  [NEW]
      [NEW]     +74 [Unmapped]                                                                               +74  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +48 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Start                            +48  [NEW]
      [NEW]     +38 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +38  [NEW]
      [NEW]     +34 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +34  [NEW]
      [NEW]     +11 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Join                             +11  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
   +28%    +816 src/core/lib/iomgr/executor.cc                                                          +816   +28%
       +88%    +501 grpc_executor_set_threading                                                             +501   +88%
       +24%    +311 executor_push                                                                           +311   +24%
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
  +6.3%    +771 src/core/lib/iomgr/ev_poll_posix.cc                                                     +771  +6.3%
      [NEW]    +331 cache_harvest_locked                                                                    +331  [NEW]
       +13%    +205 cvfd_poll                                                                               +205   +13%
       +34%    +174 run_poll                                                                                +174   +34%
      [NEW]    +169 init_result(poll_args*) [clone .constprop.19]                                           +169  [NEW]
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.21]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]
   +13%    +320 src/core/lib/iomgr/timer_manager.cc                                                     +320   +13%
       +67%    +174 start_timer_thread_and_unlock                                                           +174   +67%
      +158%    +163 gc_completed_threads                                                                    +163  +158%
   +96%    +293 src/core/tsi/alts_transport_security.cc                                                 +293   +96%
      +118%    +190 grpc_tsi_alts_shutdown                                                                  +190  +118%
      [NEW]     +56 alts_shared_resource::~alts_shared_resource                                              +56  [NEW]
      [NEW]     +47 _GLOBAL__sub_I_alts_transport_security.cc                                                +47  [NEW]

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

  +0.2% +2.50Ki TOTAL                                                                                 +114Ki  +1.5%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]    +112  +0.0%

  [ = ]       0 TOTAL     +112  +0.0%



@grpc-testing
Copy link

[trickle] No significant performance differences

/// MOVED -- contents were moved out and we're no longer tracking them
enum ThreadState { FAKE, ALIVE, STARTED, DONE, FAILED, MOVED };
ThreadState state_;
internal::ThreadInternalsInterface* impl_;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I didn't make this a UniquePtr because we should be able to use this structure without initialization, for the time being. (See the TODO above for explanation)

@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +0.0%    +162 [None]                                                                                +111Ki  +1.7%
      +0.0%    +114 [Unmapped]                                                                            +111Ki  +1.7%
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +48 vtable for grpc_core::(anonymous namespace)::ThreadInternalsPosix                        +48  [NEW]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
      +6.7%      +8 g_alts_resource                                                                            0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
  [NEW] +1.30Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.30Ki  [NEW]
      [NEW]    +616 grpc_core::Thread::Thread                                                               +616  [NEW]
      [NEW]    +275 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char co    +275  [NEW]
      [NEW]    +179 grpc_core::Thread::AwaitAll                                                             +179  [NEW]
      [NEW]     +74 [Unmapped]                                                                               +74  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +48 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Start                            +48  [NEW]
      [NEW]     +38 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +38  [NEW]
      [NEW]     +34 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +34  [NEW]
      [NEW]     +11 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Join                             +11  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
   +28%    +816 src/core/lib/iomgr/executor.cc                                                          +816   +28%
       +88%    +501 grpc_executor_set_threading                                                             +501   +88%
       +24%    +311 executor_push                                                                           +311   +24%
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
  +6.3%    +771 src/core/lib/iomgr/ev_poll_posix.cc                                                     +771  +6.3%
      [NEW]    +331 cache_harvest_locked                                                                    +331  [NEW]
       +13%    +205 cvfd_poll                                                                               +205   +13%
       +34%    +174 run_poll                                                                                +174   +34%
      [NEW]    +169 init_result(poll_args*) [clone .constprop.19]                                           +169  [NEW]
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.21]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]
   +13%    +320 src/core/lib/iomgr/timer_manager.cc                                                     +320   +13%
       +67%    +174 start_timer_thread_and_unlock                                                           +174   +67%
      +158%    +163 gc_completed_threads                                                                    +163  +158%
   +96%    +293 src/core/tsi/alts_transport_security.cc                                                 +293   +96%
      +118%    +190 grpc_tsi_alts_shutdown                                                                  +190  +118%
      [NEW]     +56 alts_shared_resource::~alts_shared_resource                                              +56  [NEW]
      [NEW]     +47 _GLOBAL__sub_I_alts_transport_security.cc                                                +47  [NEW]

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

  +0.2% +2.50Ki TOTAL                                                                                 +114Ki  +1.5%


****************************************************************

libgrpc++.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +1.2%     +58 src/cpp/server/dynamic_thread_pool.cc                                                    +58  +1.2%
      +145%    +103 grpc::DynamicThreadPool::DynamicThread::~DynamicThread                                  +103  +145%
      +6.4%     +13 grpc::DynamicThreadPool::DynamicThread::DynamicThread                                    +13  +6.4%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
       +11%      +7 [Unmapped]                                                                                +7   +11%
      [NEW]      +5 grpc::DynamicThreadPool::DynamicThread::DynamicThread(grpc::DynamicThreadPool*)::{la      +5  [NEW]
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]
  +1.8%     +44 src/cpp/thread_manager/thread_manager.cc                                                 +44  +1.8%
       +83%     +79 grpc::ThreadManager::WorkerThread::~WorkerThread                                         +79   +83%
      +8.5%     +29 grpc::ThreadManager::WorkerThread::WorkerThread                                          +29  +8.5%
       +12%     +12 [Unmapped]                                                                               +12   +12%
      [NEW]      +5 grpc::ThreadManager::WorkerThread::WorkerThread(grpc::ThreadManager*)::{lambda(void*      +5  [NEW]

 -------------- SHRINKING                                                                            --------------
  -1.2% -2.82Ki [None]                                                                               -68.5Ki  -1.3%
      -1.2% -2.49Ki [Unmapped]                                                                           -68.2Ki  -1.3%
      [DEL]    -109 typeinfo name for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc    -109  [DEL]
      [DEL]    -104 typeinfo name for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc    -104  [DEL]
      [DEL]     -40 vtable for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Threa     -40  [DEL]
      [DEL]     -40 vtable for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Dynam     -40  [DEL]
      [DEL]     -24 typeinfo for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Thr     -24  [DEL]
      [DEL]     -24 typeinfo for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Dyn     -24  [DEL]

  -0.8% -2.72Ki TOTAL                                                                                -68.4Ki  -1.3%



@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

[microbenchmarks] Performance differences noted:
Benchmark                                     cpu_time    real_time
--------------------------------------------  ----------  -----------
BM_ErrorGetPresentInt                         -6%         -6%
BM_ErrorHttpError<ErrorWithGrpcStatus>        -9%         -9%
BM_ErrorHttpError<ErrorWithNestedGrpcStatus>  -4%         -4%
BM_MetadataRefUnrefExternal                   +6%         +6%
BM_MetadataRefUnrefStatic                     +6%         +6%

GPR_ASSERT(state_ == FAILED);
}
};
void Join() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an empty line above to separate two functions

Copy link
Contributor

@sreecha sreecha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!..
Looks much cleaner.

@grpc-testing
Copy link

****************************************************************

libgrpc.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +0.0%    +138 [None]                                                                                +111Ki  +1.7%
      +0.0%     +90 [Unmapped]                                                                            +111Ki  +1.7%
      [NEW]     +48 grpc_core::(anonymous namespace)::g_cv                                                     0  [ = ]
      [NEW]     +48 vtable for grpc_core::(anonymous namespace)::ThreadInternalsPosix                        +48  [NEW]
      [NEW]     +40 grpc_core::(anonymous namespace)::g_mu                                                     0  [ = ]
      +6.7%      +8 g_alts_resource                                                                            0  [ = ]
       +33%      +8 poll_cache                                                                                 0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_thread_count                                           0  [ = ]
      [NEW]      +4 grpc_core::(anonymous namespace)::g_awaiting_threads                                       0  [ = ]
  [NEW] +1.30Ki src/core/lib/gprpp/thd_posix.cc                                                      +1.30Ki  [NEW]
      [NEW]    +616 grpc_core::Thread::Thread                                                               +616  [NEW]
      [NEW]    +275 grpc_core::(anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char co    +275  [NEW]
      [NEW]    +179 grpc_core::Thread::AwaitAll                                                             +179  [NEW]
      [NEW]     +74 [Unmapped]                                                                               +74  [NEW]
      [NEW]     +53 grpc_core::Thread::Init                                                                  +53  [NEW]
      [NEW]     +48 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Start                            +48  [NEW]
      [NEW]     +38 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +38  [NEW]
      [NEW]     +34 grpc_core::(anonymous namespace)::ThreadInternalsPosix::~ThreadInternalsPosix            +34  [NEW]
      [NEW]     +11 grpc_core::(anonymous namespace)::ThreadInternalsPosix::Join                             +11  [NEW]
      [NEW]      +5 gpr_thd_currentid                                                                         +5  [NEW]
   +26%    +768 src/core/lib/iomgr/executor.cc                                                          +768   +26%
       +78%    +442 grpc_executor_set_threading                                                             +442   +78%
       +24%    +311 executor_push                                                                           +311   +24%
      +3.4%     +23 executor_thread                                                                          +23  +3.4%
  +5.9%    +723 src/core/lib/iomgr/ev_poll_posix.cc                                                     +723  +5.9%
      [NEW]    +279 cache_harvest_locked                                                                    +279  [NEW]
       +13%    +205 cvfd_poll                                                                               +205   +13%
       +34%    +174 run_poll                                                                                +174   +34%
      [NEW]    +169 init_result(poll_args*) [clone .constprop.19]                                           +169  [NEW]
      [NEW]    +124 unref_by(grpc_fd*, int) [clone .constprop.21]                                           +124  [NEW]
       +17%     +15 cache_insert_locked                                                                      +15   +17%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
      +2.3%      +8 grpc_init_poll_cv_posix                                                                   +8  +2.3%
      +2.4%      +5 global_cv_fd_table_shutdown                                                               +5  +2.4%
      +1.5%      +3 cache_poller_locked                                                                       +3  +1.5%
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]
   +11%    +272 src/core/lib/iomgr/timer_manager.cc                                                     +272   +11%
       +67%    +174 start_timer_thread_and_unlock                                                           +174   +67%
      +117%    +120 gc_completed_threads                                                                    +120  +117%
   +78%    +237 src/core/tsi/alts_transport_security.cc                                                 +237   +78%
       +83%    +134 grpc_tsi_alts_shutdown                                                                  +134   +83%
      [NEW]     +56 alts_shared_resource::~alts_shared_resource                                              +56  [NEW]
      [NEW]     +47 _GLOBAL__sub_I_alts_transport_security.cc                                                +47  [NEW]

 -------------- SHRINKING                                                                            --------------
  [DEL]    -988 src/core/lib/gpr/thd_posix.cc                                                           -988  [DEL]
      [DEL]    -540 gpr_thd_new                                                                             -540  [DEL]
      [DEL]    -138 thread_body                                                                             -138  [DEL]
      [DEL]    -108 gpr_await_threads                                                                       -108  [DEL]
      [DEL]     -92 dec_thd_count() [clone .part.0]                                                          -92  [DEL]
      [DEL]     -53 gpr_thd_init                                                                             -53  [DEL]
      [DEL]     -45 [Unmapped]                                                                               -45  [DEL]
      [DEL]      -7 gpr_thd_join                                                                              -7  [DEL]
      [DEL]      -5 gpr_thd_currentid                                                                         -5  [DEL]
  [DEL]    -147 src/core/lib/gpr/thd.cc                                                                 -147  [DEL]
      [DEL]     -54 gpr_thd_options_default                                                                  -54  [DEL]
      [DEL]     -44 [Unmapped]                                                                               -44  [DEL]
      [DEL]     -22 gpr_thd_options_is_detached                                                              -22  [DEL]
      [DEL]     -19 gpr_thd_options_is_joinable                                                              -19  [DEL]
      [DEL]      -4 gpr_thd_options_set_detached                                                              -4  [DEL]
      [DEL]      -4 gpr_thd_options_set_joinable                                                              -4  [DEL]

  +0.2% +2.28Ki TOTAL                                                                                 +113Ki  +1.5%


****************************************************************

libgrpc++.so

     VM SIZE                                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                                              ++++++++++++++
  +0.2%     +10 src/cpp/server/dynamic_thread_pool.cc                                                    +10  +0.2%
       +70%     +50 grpc::DynamicThreadPool::DynamicThread::~DynamicThread                                   +50   +70%
      +6.4%     +13 grpc::DynamicThreadPool::DynamicThread::DynamicThread                                    +13  +6.4%
       +19%     +12 [Unmapped]                                                                               +12   +19%
      [NEW]      +9 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +9  [NEW]
      [NEW]      +5 grpc::DynamicThreadPool::DynamicThread::DynamicThread(grpc::DynamicThreadPool*)::{la      +5  [NEW]
      [NEW]      +2 grpc_core::internal::ThreadInternalsInterface::~ThreadInternalsInterface                  +2  [NEW]

 -------------- SHRINKING                                                                            --------------
  -1.3% -2.85Ki [None]                                                                               -68.6Ki  -1.3%
      -1.2% -2.52Ki [Unmapped]                                                                           -68.3Ki  -1.3%
      [DEL]    -109 typeinfo name for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc    -109  [DEL]
      [DEL]    -104 typeinfo name for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc    -104  [DEL]
      [DEL]     -40 vtable for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Threa     -40  [DEL]
      [DEL]     -40 vtable for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Dynam     -40  [DEL]
      [DEL]     -24 typeinfo for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Thr     -24  [DEL]
      [DEL]     -24 typeinfo for std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::Dyn     -24  [DEL]
  -0.2%      -4 src/cpp/thread_manager/thread_manager.cc                                                  -4  -0.2%
      [DEL]     -32 std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::ThreadManager::W     -32  [DEL]
      [DEL]     -30 std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::ThreadManager::W     -30  [DEL]
      [DEL]     -19 std::thread::_State_impl<std::_Bind_simple<std::_Mem_fn<void (grpc::ThreadManager::W     -19  [DEL]

  -0.8% -2.85Ki TOTAL                                                                                -68.6Ki  -1.3%



@grpc-testing
Copy link

[trickle] No significant performance differences

@grpc-testing
Copy link

[microbenchmarks] No significant performance differences

@vjpai
Copy link
Member Author

vjpai commented Mar 3, 2018

Test failures are all grpc-node issues and seem to be infrastructural.

@vjpai vjpai merged commit 6eae794 into grpc:master Mar 3, 2018
Core conversion to idiomatic C++ automation moved this from In progress to Done Mar 3, 2018
@vjpai vjpai deleted the 2phase_thd branch March 3, 2018 05:13
@vjpai
Copy link
Member Author

vjpai commented Mar 5, 2018

By removing the use of std::thread, this PR also contributes to the resolution of #13706

@vjpai vjpai mentioned this pull request Mar 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
@lock lock bot unassigned sreecha Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants