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

STEllAR-GROUP / hpx / #881

05 Feb 2023 11:26PM UTC coverage: 86.546% (+0.6%) from 85.952%
#881

push

StellarBot
Merge #6157

6157: Improve index_queue_spawning r=hkaiser a=hkaiser

- synchronous for_each_partitioner now binds tasks to cores
- add scheduling properties: get_first_core and with_first_core
- index_queue_spawning now supports first_core
- adapt rotate to use first_core for partitions


Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

416 of 416 new or added lines in 18 files covered. (100.0%)

174866 of 202049 relevant lines covered (86.55%)

1824233.11 hits per line

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

66.67
/libs/core/coroutines/src/thread_enums.cpp
1
//  Copyright (c) 2007-2023 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach, Katelyn Kufahl
3
//  Copyright (c) 2008-2009 Chirag Dekate, Anshul Tandon
4
//  Copyright (c) 2015 Patricia Grubel
5
//  Copyright (c) 2017 Shoshana Jakobovits
6
//
7
//  SPDX-License-Identifier: BSL-1.0
8
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
9
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10

11
#include <hpx/coroutines/thread_enums.hpp>
12

13
#include <cstddef>
14
#include <cstdint>
15
#include <ostream>
16

17
namespace hpx::threads {
18

19
    ///////////////////////////////////////////////////////////////////////
20
    namespace strings {
21

22
        // clang-format off
23
        inline constexpr char const* const thread_state_names[] = {
24
            "unknown",
25
            "active",
26
            "pending",
27
            "suspended",
28
            "depleted",
29
            "terminated",
30
            "staged",
31
            "pending_do_not_schedule",
32
            "pending_boost"
33
        };
34
        // clang-format on
35

36
    }    // namespace strings
37

38
    char const* get_thread_state_name(thread_schedule_state state) noexcept
45,978,260✔
39
    {
40
        if (state < thread_schedule_state::active ||
45,978,260✔
41
            state > thread_schedule_state::pending_boost)
45,978,960✔
42
        {
43
            return "unknown";
×
44
        }
45
        return strings::thread_state_names[static_cast<std::size_t>(state)];
45,979,622✔
46
    }
45,979,663✔
47

48
    char const* get_thread_state_name(thread_state state) noexcept
10✔
49
    {
50
        return get_thread_state_name(state.state());
10✔
51
    }
52

53
    std::ostream& operator<<(std::ostream& os, thread_schedule_state t)
51✔
54
    {
55
        os << get_thread_state_name(t) << " (" << static_cast<std::uint32_t>(t)
51✔
56
           << ")";
51✔
57
        return os;
51✔
58
    }
59

60
    ///////////////////////////////////////////////////////////////////////
61
    namespace strings {
62

63
        // clang-format off
64
        inline constexpr char const* const thread_state_ex_names[] = {
65
            "wait_unknown",
66
            "wait_signaled",
67
            "wait_timeout",
68
            "wait_terminate",
69
            "wait_abort"
70
        };
71
        // clang-format on
72

73
    }    // namespace strings
74

75
    char const* get_thread_state_ex_name(thread_restart_state state_ex) noexcept
×
76
    {
77
        if (state_ex < thread_restart_state::signaled ||
×
78
            state_ex > thread_restart_state::abort)
×
79
        {
80
            return "wait_unknown";
×
81
        }
82
        return strings::thread_state_ex_names[static_cast<std::size_t>(
×
83
            state_ex)];
×
84
    }
×
85

86
    std::ostream& operator<<(std::ostream& os, thread_restart_state t)
×
87
    {
88
        os << get_thread_state_ex_name(t) << " ("
×
89
           << static_cast<std::uint32_t>(t) << ")";
×
90
        return os;
×
91
    }
92

93
    ///////////////////////////////////////////////////////////////////////
94
    namespace strings {
95

96
        // clang-format off
97
        inline constexpr char const* const thread_priority_names[] = {
98
            "default",
99
            "low",
100
            "normal",
101
            "high (recursive)",
102
            "boost",
103
            "high (non-recursive)",
104
            "bound",
105
        };
106
        // clang-format on
107
    }    // namespace strings
108

109
    char const* get_thread_priority_name(thread_priority priority) noexcept
11,384,963✔
110
    {
111
        if (priority < thread_priority::default_ ||
11,384,963✔
112
            priority > thread_priority::bound)
11,384,996✔
113
        {
114
            return "unknown";
×
115
        }
116
        return strings::thread_priority_names[static_cast<std::size_t>(
11,385,059✔
117
            priority)];
11,385,059✔
118
    }
11,385,070✔
119

120
    std::ostream& operator<<(std::ostream& os, thread_priority t)
6,795,613✔
121
    {
122
        os << get_thread_priority_name(t) << " ("
6,795,625✔
123
           << static_cast<std::uint32_t>(t) << ")";
6,795,625✔
124
        return os;
6,795,625✔
125
    }
126

127
    namespace strings {
128

129
        // clang-format off
130
        inline constexpr char const* const stack_size_names[] = {
131
            "small",
132
            "medium",
133
            "large",
134
            "huge",
135
            "nostack",
136
        };
137
        // clang-format on
138

139
    }    // namespace strings
140

141
    char const* get_stack_size_enum_name(thread_stacksize size) noexcept
14✔
142
    {
143
        if (size == thread_stacksize::unknown)
14✔
144
            return "unknown";
×
145

146
        if (size < thread_stacksize::small_ || size > thread_stacksize::nostack)
14✔
147
            return "custom";
×
148

149
        return strings::stack_size_names[static_cast<std::size_t>(size) - 1];
14✔
150
    }
14✔
151

152
    std::ostream& operator<<(std::ostream& os, thread_stacksize t)
12✔
153
    {
154
        os << get_stack_size_enum_name(t) << " ("
12✔
155
           << static_cast<std::uint32_t>(t) << ")";
12✔
156
        return os;
12✔
157
    }
158
}    // namespace hpx::threads
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