<commit_before>#include <iostream>

#include <csignal>

#include "OrbitGrpcServer.h"
#include "OrbitService.h"
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/flags/usage.h"

ABSL_FLAG(uint16_t, asio_port, 44766, "Asio TCP server port");

// TODO: Default it 127.0.0.1 once ssh tunneling is enabled.
ABSL_FLAG(std::string, grpc_server_address, "0.0.0.0:44755",
          "Grpc server address");

namespace {
std::atomic<bool> exit_requested;

void sigint_handler(int signum) {
  if (signum == SIGINT) {
    exit_requested = true;
  }
}

void install_sigint_handler() {
  struct sigaction act;
  act.sa_handler = sigint_handler;
  sigemptyset(&act.sa_mask);
  act.sa_flags = 0;
  act.sa_restorer = nullptr;
  sigaction(SIGINT, &act, nullptr);
}
}  // namespace

int main(int argc, char** argv) {
  absl::SetProgramUsageMessage("Orbit CPU Profiler Service");
  absl::ParseCommandLine(argc, argv);

  install_sigint_handler();

  std::unique_ptr<OrbitGrpcServer> grpc_server;
  std::string grpc_server_address = absl::GetFlag(FLAGS_grpc_server_address);
  std::cout << "Starting GRPC server at " << grpc_server_address << std::endl;
  grpc_server = OrbitGrpcServer::Create(grpc_server_address);

  uint16_t asio_port = absl::GetFlag(FLAGS_asio_port);
  std::cout << "Starting OrbitService" << std::endl;
  OrbitService service{asio_port};
  exit_requested = false;
  service.Run(&exit_requested);
}<commit_msg>Call grpc_server->Shutdown() and ->Wait() in OrbitService's main<commit_after>#include <iostream>

#include <csignal>

#include "OrbitGrpcServer.h"
#include "OrbitService.h"
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/flags/usage.h"

ABSL_FLAG(uint16_t, asio_port, 44766, "Asio TCP server port");

// TODO: Default it 127.0.0.1 once ssh tunneling is enabled.
ABSL_FLAG(std::string, grpc_server_address, "0.0.0.0:44755",
          "Grpc server address");

namespace {
std::atomic<bool> exit_requested;

void sigint_handler(int signum) {
  if (signum == SIGINT) {
    exit_requested = true;
  }
}

void install_sigint_handler() {
  struct sigaction act;
  act.sa_handler = sigint_handler;
  sigemptyset(&act.sa_mask);
  act.sa_flags = 0;
  act.sa_restorer = nullptr;
  sigaction(SIGINT, &act, nullptr);
}
}  // namespace

int main(int argc, char** argv) {
  absl::SetProgramUsageMessage("Orbit CPU Profiler Service");
  absl::ParseCommandLine(argc, argv);

  install_sigint_handler();

  std::unique_ptr<OrbitGrpcServer> grpc_server;
  std::string grpc_server_address = absl::GetFlag(FLAGS_grpc_server_address);
  std::cout << "Starting GRPC server at " << grpc_server_address << std::endl;
  grpc_server = OrbitGrpcServer::Create(grpc_server_address);

  uint16_t asio_port = absl::GetFlag(FLAGS_asio_port);
  std::cout << "Starting OrbitService" << std::endl;
  OrbitService service{asio_port};
  exit_requested = false;
  service.Run(&exit_requested);

  grpc_server->Shutdown();
  grpc_server->Wait();
}
{'fraction_non_alphanumeric': 0.13712938005390835, 'fraction_numerical': 0.016846361185983826, 'mean_word_length': 5.4825327510917035, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5732625', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1088, 'n_words': 210}