Skip to content

Instantly share code, notes, and snippets.

@rzarzynski
Last active May 16, 2019 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rzarzynski/024a6794e28391c76f7d95af741ba11d to your computer and use it in GitHub Desktop.
Save rzarzynski/024a6794e28391c76f7d95af741ba11d to your computer and use it in GitHub Desktop.

32 KB write profiling

Captured at incerta07.

ceph-osd

-   23,45%     0,01%  msgr-worker-0  ceph-osd              [.] std::_Function_handler<void (), NetworkStack::add_thread(unsigned int)::{lambda()#1}>::_M_invoke                                  ▒
   - 23,44% std::_Function_handler<void (), NetworkStack::add_thread(unsigned int)::{lambda()#1}>::_M_invoke                                                                                     ▒
      - 23,17% EventCenter::process_events                                                                                                                                                       ▒
         - 19,41% AsyncConnection::process                                                                                                                                                       ▒
            - 19,28% ProtocolV2::run_continuation                                                                                                                                                ▒
               - 14,75% ProtocolV2::handle_read_frame_segment                                                                                                                                    ▒
                  - 13,24% ProtocolV2::read_frame_segment                                                                                                                                        ▒
                     - 12,89% ProtocolV2::read                                                                                                                                                   ▒
                        - 12,86% AsyncConnection::read                                                                                                                                           ▒
                           - 12,68% AsyncConnection::read_until                                                                                                                                  ▒
                              - AsyncConnection::read_bulk                                                                                                                                       ▒
                                 - 12,56% 0xe70d                                                                                                                                                 ▒
                                    - 12,56% return_from_SYSCALL_64                                                                                                                              ▒
                                       - 12,54% do_syscall_64                                                                                                                                    ▒
                                          - 12,46% sys_read                                                                                                                                      ▒
                                             - 12,39% vfs_read                                                                                                                                   ▒
                                                + 12,27% __vfs_read                                                                                                                              ▒
                                                + 0,06% rw_verify_area                                                                                                                           ▒
                             0,15% __memcpy_ssse3                                                                                                                                                ▒
                     + 0,25% ceph::buffer::create_aligned                                                                                                                                        ▒
                  + 1,34% ProtocolV2::read                                                                                                                                                       ▒
               + 4,00% ProtocolV2::handle_read_frame_epilogue_main                                                                                                                               ▒
               + 0,14% ProtocolV2::throttle_dispatch_queue                                                                                                                                       ▒
                 0,10% ProtocolV2::read_frame                                                                                                                                                    ▒
               + 0,09% ProtocolV2::throttle_bytes                                                                                                                                                ▒
                 0,07% ceph_crc32c_intel_baseline                                                                                                                                                ▒
            + 0,08% AsyncConnection::read                                                                                                                                                        ▒
         + 3,21% AsyncConnection::handle_write                                                                                                                                                   ▒
         + 0,42% 0xf8923                                                                                                                                                                         ▒
      + 0,19% 0xe70d                                                                                                                                                                             ▒

crimson-osd

-   95,20%     0,00%  crimson-osd  crimson-osd          [.] seastar::app_template::run_deprecated                                                                                                ▒
   - seastar::app_template::run_deprecated                                                                                                                                                       ▒
      - 95,16% seastar::reactor::run                                                                                                                                                             ▒
         - 93,20% seastar::reactor::run_some_tasks                                                                                                                                               ▒
            - 93,13% seastar::reactor::run_tasks                                                                                                                                                 ▒
               - 86,91% seastar::internal::repeater<seastar::future<> seastar::keep_doing<ceph::net::ProtocolV2::execute_ready()::{lambda()#1}::operator()() const::{lambda()#1}>(ceph::net::Prot▒
                  - 86,77% seastar::future<> seastar::keep_doing<ceph::net::ProtocolV2::execute_ready()::{lambda()#1}::operator()() const::{lambda()#1}>(ceph::net::ProtocolV2::execute_ready()::▒
                     - 86,34% seastar::futurize<seastar::future<> >::apply<ceph::net::ProtocolV2::execute_ready()::{lambda()#1}::operator()() const::{lambda()#1}::operator()() const::{lambda(ce▒
                        - 86,16% ceph::net::ProtocolV2::read_message                                                                                                                             ▒
                           - 72,65% ceph::net::ProtocolV2::read_frame_payload                                                                                                                    ▒
                              - 72,10% ceph::net::ProtocolV2::read_frame_payload()::{lambda()#2}::operator()                                                                                     ▒
                                 - 71,65% ceph::net::ProtocolV2::read_exactly                                                                                                                    ▒
                                    - 71,59% ceph::net::Socket::read_exactly                                                                                                                     ▒
                                       - 71,46% seastar::input_stream<char>::read_exactly                                                                                                        ▒
                                          - 58,33% __memmove_ssse3                                                                                                                               ▒
                                             - 58,05% page_fault                                                                                                                                 ▒
                                                - do_page_fault                                                                                                                                  ▒
                                                   + 57,99% __do_page_fault                                                                                                                      ▒
                                          - 12,90% seastar::input_stream<char>::read_exactly_part                                                                                                ▒
                                             - 10,14% _ZN7seastar6futureIJNS_16temporary_bufferIcEEEE9then_implIZNS_12input_streamIcE17read_exactly_partEmS2_mEUlT_E_S3_EET0_OS7_                ▒
                                                - _ZN7seastar8futurizeINS_6futureIJNS_16temporary_bufferIcEEEEEE5applyIZNS_12input_streamIcE17read_exactly_partEmS3_mEUlT_E_JS3_EEES4_OS9_OSt5tup▒
                                                   - 8,13% seastar::input_stream<char>::read_exactly_part                                                                                        ▒
                                                      - 6,71% _ZN7seastar6futureIJNS_16temporary_bufferIcEEEE9then_implIZNS_12input_streamIcE17read_exactly_partEmS2_mEUlT_E_S3_EET0_OS7_        ▒
                                                         - _ZN7seastar8futurizeINS_6futureIJNS_16temporary_bufferIcEEEEEE5applyIZNS_12input_streamIcE17read_exactly_partEmS3_mEUlT_E_JS3_EEES4_OS▒
                                                            - 5,24% seastar::input_stream<char>::read_exactly_part                                                                               ▒
                                                               - 3,95% _ZN7seastar6futureIJNS_16temporary_bufferIcEEEE9then_implIZNS_12input_streamIcE17read_exactly_partEmS2_mEUlT_E_S3_EET0_OS7▒
                                                                  - _ZN7seastar8futurizeINS_6futureIJNS_16temporary_bufferIcEEEEEE5applyIZNS_12input_streamIcE17read_exactly_partEmS3_mEUlT_E_JS3▒
                                                                     - 2,26% seastar::input_stream<char>::read_exactly_part                                                                      ▒
                                                                        - 1,87% seastar::net::posix_data_source_impl::get                                                                        ▒
                                                                           - 1,85% seastar::pollable_fd::read_some                                                                               ▒
                                                                              - 1,73% 0xe70d                                                                                                     ▒
                                                                                 - 1,71% return_from_SYSCALL_64                                                                                  ▒
                                                                                      do_syscall_64                                                                                              ▒
                                                                                    + sys_read                                                                                                   ▒
                                                                                0,08% seastar::reactor::read_some                                                                                ▒
                                                                        + 0,39% _ZN7seastar6futureIJNS_16temporary_bufferIcEEEE9then_implIZNS_12input_streamIcE17read_exactly_partEmS2_mEUlT_E_S3▒
                                                                     + 1,50% __memmove_ssse3                                                                                                     ▒
                                                                       0,14% native_irq_return_iret                                                                                              ▒
                                                               + 1,21% seastar::net::posix_data_source_impl::get                                                                                 ▒
                                                            + 1,35% __memmove_ssse3                                                                                                              ▒
                                                              0,10% native_irq_return_iret                                                                                                       ▒
                                                      + 1,40% seastar::net::posix_data_source_impl::get                                                                                          ▒
                                                   + 1,81% __memmove_ssse3                                                                                                                       ▒
                                                     0,12% native_irq_return_iret                                                                                                                ▒
                                             + 2,64% seastar::net::posix_data_source_impl::get                                                                                                   ▒                                                                                               ▒
                                          + 0,10% seastar::memory::allocate_aligned                                                                                                              ▒
                                            0,08% native_irq_return_iret                                                                                                                         ▒
                                   0,12% ceph::buffer::create                                                                                                                                    ▒
                                   0,08% ceph::buffer::v14_2_0::list::list                                                                                                                       ▒
                                   0,08% ceph::buffer::v14_2_0::ptr::ptr                                                                                                                         ▒
                                0,14% ceph_crc32c_intel_baseline                                                                                                                                 ▒
                                0,06% ceph::buffer::v14_2_0::list::crc32c                                                                                                                        ▒
                           + 13,30% ceph::net::ProtocolV2::read_message(utime_t)::{lambda()#1}::operator()                                                                                       ▒
                     + 0,33% ceph::net::ProtocolV2::read_main_preamble                                                                                                                           ▒
               + 1,77% _ZN7seastar12continuationIZZNS_6futureIJEE9then_implIZN4ceph3net10ProtocolV212read_messageE7utime_tEUlvE_S2_EET0_OT_ENKUlvE_clEvEUlSB_E_JEE15run_and_disposeEv            ▒
               + 1,45% 0xec6d                                                                                                                                                                    ▒
               + 0,68% seastar::continuation<seastar::future<> seastar::future<ceph::msgr::v2::Tag>::then_impl<ceph::net::ProtocolV2::execute_ready()::{lambda()#1}::operator()() const::{lambda(▒
               + 0,55% _ZN7seastar12continuationIZZNS_6futureIJNS_16temporary_bufferIcEEEE9then_implIZNS_12input_streamIcE17read_exactly_partEmS3_mEUlT_E_S4_EET0_OS8_ENKUlvE_clEvEUlSB_E_JS3_EE1▒
               + 0,23% _ZN7seastar12continuationIZZNS_6futureIJEE17then_wrapped_implIZNS_13output_streamIcE10poll_flushEvEUlS2_E0_S2_EET0_OT_ENKUlvE_clEvEUlS9_E_JEE15run_and_disposeEv          ▒
               + 0,22% 0xe70d                                                                                                                                                                    ▒
               + 0,16% seastar::continuation<seastar::future<> seastar::do_for_each<std::_Deque_iterator<ceph::net::Dispatcher*, ceph::net::Dispatcher*&, ceph::net::Dispatcher**>, ChainedDispat▒
               + 0,12% _ZN7seastar12continuationIZZNS_6futureIJN5boost16local_shared_ptrI11ObjectStateEEEE9then_implIZZN2PG10do_osd_opsENS2_13intrusive_ptrI6MOSDOpEEENKUlRT_RT0_E_clISB_N4ceph2o▒
               + 0,12% seastar::internal::do_until_state<ceph::net::ProtocolV2::read_frame_payload()::{lambda()#1}, ceph::net::ProtocolV2::read_frame_payload()::{lambda()#2}>::run_and_dispose  ▒
               + 0,12% _ZN7seastar12continuationIZZNS_6futureIJN5boost13intrusive_ptrI11MOSDOpReplyEEEE9then_implIZN2PG9handle_opEPN4ceph3net10ConnectionENS3_I6MOSDOpEEEUlS5_E0_NS1_IJEEEEET0_OT▒
                 0,08% _ZN7seastar12continuationIZZNS_6futureIJEE9then_implIZZN2PG10do_osd_opsEN5boost13intrusive_ptrI6MOSDOpEEENKUlRT_RT0_E_clIS8_N4ceph2os11TransactionEEEDaSA_SC_EUlvE0_NS1_IJ▒
               + 0,08% _ZN7seastar12continuationIZZNS_6futureIJN4ceph6buffer7v14_2_03ptrEEE17then_wrapped_implIZN9PGBackend8_load_osERK9hobject_tEUlT_E_NS1_IJN5boost16local_shared_ptrI11ObjectS▒
                 0,06% _ZN7seastar12continuationIZZNS_6futureIJEE9then_implIZNS_3net20posix_data_sink_impl3putENS4_6packetEEUlvE_S2_EET0_OT_ENKUlvE_clEvEUlSA_E_JEE15run_and_disposeEv           ▒
         + 1,65% std::_Function_handler<bool (), seastar::reactor::run()::{lambda()#6}>::_M_invoke                                                                                               ▒
template <typename CharType>
future<temporary_buffer<CharType>>
input_stream<CharType>::read_exactly(size_t n) {
    if (_buf.size() == n) {
        // easy case: steal buffer, return to caller
        return make_ready_future<tmp_buf>(std::move(_buf));
    } else if (_buf.size() > n) {
        // buffer large enough, share it with caller
        auto front = _buf.share(0, n);
        _buf.trim_front(n);
        return make_ready_future<tmp_buf>(std::move(front));
    } else if (_buf.size() == 0) {
        // buffer is empty: grab one and retry
        return _fd.get().then([this, n] (auto buf) mutable {
            if (buf.size() == 0) {
                _eof = true;
                return make_ready_future<tmp_buf>(std::move(buf));
            }
            _buf = std::move(buf);
            return this->read_exactly(n);
        });
    } else {
        // buffer too small: start copy/read loop
        tmp_buf b(n);
        return read_exactly_part(n, std::move(b), 0);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment