fix compiler errors

This commit is contained in:
Markus Pilman 2021-04-09 15:16:07 -06:00
parent 2064903705
commit 20d98421af
4 changed files with 24 additions and 22 deletions

View File

@ -26,9 +26,18 @@
using namespace std::literals;
std::string_view to_string(WaitState w) {
switch (w) {
case WaitState::Running:
return "Running";
case WaitState::DiskIO:
return "DiskIO";
}
}
class Packer : public msgpack::packer<msgpack::sbuffer> {
struct visitor_t {
using VisitorMap = std::unordered_map<std::type_info, std::function<void(std::any const&, Packer& packer)>>;
using VisitorMap = std::unordered_map<std::type_index, std::function<void(std::any const&, Packer& packer)>>;
VisitorMap visitorMap;
template <class T>
@ -42,7 +51,7 @@ class Packer : public msgpack::packer<msgpack::sbuffer> {
template <class Head, class... Tail>
struct populate_visitor_map<Head, Tail...> {
static void populate(VisitorMap& map) {
map.emplace(any_visitor<Head>);
map.emplace(std::type_index(typeid(Head)), any_visitor<Head>);
populate_visitor_map<Tail...>::populate(map);
}
};

View File

@ -45,14 +45,7 @@ struct IALPCollector : IALPCollectorBase {
enum class WaitState { Running, DiskIO };
std::string_view to_string(WaitState w) {
switch (w) {
case WaitState::Running:
return "Running";
case WaitState::DiskIO:
return "DiskIO";
}
}
std::string_view to_string(WaitState w);
struct Sample : std::enable_shared_from_this<Sample> {
double time = 0.0;
@ -63,7 +56,7 @@ struct Sample : std::enable_shared_from_this<Sample> {
class SampleCollectorT {
public: // Types
friend class crossbow::singleton<SampleCollectorT>;
friend struct crossbow::create_static<SampleCollectorT>;
using Getter = std::function<std::vector<Reference<ActorLineage>>()>;
private:

View File

@ -7,17 +7,17 @@
// However, this should be good enough for an initial
// proof of concept.
extern "C" void stackSignalHandler(int sig) {
auto stack = getActorStackTrace();
int i = 0;
while (!stack.empty()) {
auto s = stack.top();
stack.pop();
std::string_view n(reinterpret_cast<const char*>(s.begin()), s.size());
std::cout << i << ": " << n << std::endl;
++i;
}
auto stack = getActorStackTrace();
int i = 0;
while (!stack.empty()) {
auto s = stack.back();
stack.pop_back();
std::string_view n(reinterpret_cast<const char*>(s.begin()), s.size());
std::cout << i << ": " << n << std::endl;
++i;
}
}
void setupStackSignal() {
std::signal(SIGUSR1, &stackSignalHandler);
std::signal(SIGUSR1, &stackSignalHandler);
}

View File

@ -41,7 +41,7 @@ ActorLineage::~ActorLineage() {
using namespace std::literals;
std::string_view StackLineage::name = "StackLineage"sv;
const std::string_view StackLineage::name = "StackLineage"sv;
std::vector<StringRef> getActorStackTrace() {
return currentLineage->stack(&StackLineage::actorName);