• 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
/examples/throttle/spin.cpp
1
//  Copyright (c) 2011 Bryce Lelbach
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/hpx.hpp>
8
#include <hpx/hpx_init.hpp>
9
#include <hpx/include/util.hpp>
10

11
#include <iostream>
12
#include <string>
13
#include <vector>
14

15
using hpx::program_options::options_description;
16
using hpx::program_options::variables_map;
17

18
using hpx::finalize;
19
using hpx::init;
20

21
using hpx::id_type;
22
using hpx::naming::address;
23
using hpx::naming::get_locality_id_from_gid;
24

25
///////////////////////////////////////////////////////////////////////////////
26
int hpx_main()
×
27
{
28
    {
29
        std::cout << "commands: localities, help, quit\n";
×
30

31
        while (true)
32
        {
33
            std::cout << "> ";
×
34

35
            std::string arg;
36
            std::getline(std::cin, arg);
×
37

38
            if (arg.empty())
×
39
                continue;
×
40

41
            else if (0 == std::string("quit").find(arg))
×
42
                break;
43

44
            else if (0 == std::string("localities").find(arg))
×
45
            {
46
                std::vector<id_type> localities = hpx::find_all_localities();
×
47

48
                for (id_type const& locality_ : localities)
×
49
                {
50
                    address addr =
51
                        hpx::agas::resolve(hpx::launch::sync, locality_);
×
52

53
                    hpx::util::format_to(std::cout, "  [{1}] {2}\n",
×
54
                        get_locality_id_from_gid(locality_.get_gid()),
×
55
                        addr.locality_);
56
                }
57

58
                continue;
59
            }
×
60

61
            else if (0 != std::string("help").find(arg))
×
62
                hpx::util::format_to(
×
63
                    std::cout, "error: unknown command '{1}'\n", arg);
64

65
            std::cout << "commands: localities, help, quit\n";
×
66
        }
67
    }
68

69
    finalize();
70
    return 0;
×
71
}
72

73
///////////////////////////////////////////////////////////////////////////////
74
int main(int argc, char* argv[])
×
75
{
76
    // Configure application-specific options.
77
    options_description desc_commandline(
78
        "Usage: " HPX_APPLICATION_STRING " [options]");
×
79

80
    // We force this application to use at least 2 threads by default.
81
    std::vector<std::string> const cfg = {"hpx.os_threads=2"};
×
82

83
    // Initialize and run HPX.
84
    hpx::init_params init_args;
×
85
    init_args.desc_cmdline = desc_commandline;
×
86
    init_args.cfg = cfg;
×
87

88
    return hpx::init(argc, argv, init_args);
×
89
}
×
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