• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/core/threading_base/src/print.cpp
1
//  Copyright (c) 2019 John Biddiscombe
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#include <hpx/threading_base/print.hpp>
9
#include <hpx/threading_base/thread_data.hpp>
10

11
#include <cstdint>
12
#include <iomanip>
13
#include <thread>
14

15
/// \cond NODETAIL
16
namespace hpx::debug {
17

18
    std::ostream& operator<<(
×
19
        std::ostream& os, threadinfo<threads::thread_data*> const& d)
20
    {
21
        os << ptr(d.data) << " \""
×
22
           << ((d.data != nullptr) ? d.data->get_description() : "nullptr")
×
23
           << "\"";
×
24
        return os;
×
25
    }
26

27
    std::ostream& operator<<(
×
28
        std::ostream& os, threadinfo<threads::thread_id_type*> const& d)
29
    {
30
        if (d.data == nullptr)
×
31
        {
32
            os << "nullptr";
×
33
        }
34
        else
35
        {
36
            os << threadinfo<threads::thread_data*>(
×
37
                get_thread_id_data(*d.data));
×
38
        }
39
        return os;
×
40
    }
41

42
    std::ostream& operator<<(
×
43
        std::ostream& os, threadinfo<threads::thread_id_ref_type*> const& d)
44
    {
45
        if (d.data == nullptr)
×
46
        {
47
            os << "nullptr";
×
48
        }
49
        else
50
        {
51
            os << threadinfo<threads::thread_data*>(
×
52
                get_thread_id_data(*d.data));
×
53
        }
54
        return os;
×
55
    }
56

57
    std::ostream& operator<<(
×
58
        std::ostream& os, threadinfo<hpx::threads::thread_init_data> const& d)
59
    {
60
#if defined(HPX_HAVE_THREAD_DESCRIPTION)
61
        os << std::left << " \"" << d.data.description.get_description()
62
           << "\"";
63
#else
64
        os << "??? " << /*hex<8,uintptr_t>*/ (std::uintptr_t(&d.data));
×
65
#endif
66
        return os;
×
67
    }
68

69
    // helper class for printing thread ID, either std:: or hpx::
70
    namespace detail {
71

72
        void print_thread_info(std::ostream& os)
×
73
        {
74
            if (hpx::threads::get_self_id() == hpx::threads::invalid_thread_id)
×
75
            {
76
                os << "-------------- ";
×
77
            }
78
            else
79
            {
80
                hpx::threads::thread_data const* dummy =
81
                    hpx::threads::get_self_id_data();
×
82
                os << dummy << " ";
×
83
            }
84
            os << hex<12, std::thread::id>(std::this_thread::get_id())
×
85
#ifdef DEBUGGING_PRINT_LINUX
86
               << " cpu " << debug::dec<3, int>(sched_getcpu()) << " ";
87
#else
88
               << " cpu --- ";
×
89
#endif
90
        }
×
91

92
        struct current_thread_print_helper
93
        {
94
            current_thread_print_helper()
95
            {
96
                detail::register_print_info(&detail::print_thread_info);
97
            }
98

99
            static current_thread_print_helper helper_;
100
        };
101

102
        current_thread_print_helper current_thread_print_helper::helper_{};
103
    }    // namespace detail
104
}    // namespace hpx::debug
105
/// \endcond
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc