Exemple #1
0
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts)
  {
    uint32_t PID = parser.get<uint32_t>("PID");
    std::string workingDir = parser.get<string>("working-dir");
    std::string logFile = parser.get<string>("capture-file");

    std::cout << "Injecting into PID " << PID << std::endl;

    uint32_t ident = RENDERDOC_InjectIntoProcess(PID, NULL, logFile.empty() ? "" : logFile.c_str(),
                                                 &opts, parser.exist("wait-for-exit"));

    if(ident == 0)
    {
      std::cerr << "Failed to inject." << std::endl;
      return 2;
    }

    if(parser.exist("wait-for-exit"))
    {
      std::cerr << PID << " finished executing." << std::endl;
      ident = 0;
    }
    else
    {
      std::cerr << "Launched as ID " << ident << std::endl;
    }

    return ident;
  }
Exemple #2
0
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts)
  {
    if(parser.rest().empty())
    {
      std::cerr << "Error: capture command requires an executable to launch." << std::endl
                << std::endl
                << parser.usage();
      return 0;
    }

    std::string executable = parser.rest()[0];
    std::string workingDir = parser.get<string>("working-dir");
    std::string cmdLine;
    std::string logFile = parser.get<string>("capture-file");

    for(size_t i = 1; i < parser.rest().size(); i++)
    {
      if(!cmdLine.empty())
        cmdLine += ' ';

      cmdLine += EscapeArgument(parser.rest()[i]);
    }

    std::cout << "Launching '" << executable << "'";

    if(!cmdLine.empty())
      std::cout << " with params: " << cmdLine;

    std::cout << std::endl;

    uint32_t ident = RENDERDOC_ExecuteAndInject(
        executable.c_str(), workingDir.empty() ? "" : workingDir.c_str(),
        cmdLine.empty() ? "" : cmdLine.c_str(), NULL, logFile.empty() ? "" : logFile.c_str(), &opts,
        parser.exist("wait-for-exit"));

    if(ident == 0)
    {
      std::cerr << "Failed to create & inject." << std::endl;
      return 2;
    }

    if(parser.exist("wait-for-exit"))
    {
      std::cerr << "'" << executable << "' finished executing." << std::endl;
      ident = 0;
    }
    else
    {
      std::cerr << "Launched as ID " << ident << std::endl;
    }

    return ident;
  }
Exemple #3
0
void send2supervisor(
    const string& cmd,
    const string& type,
    const string& name,
    const string& zkhosts,
    const cmdline::parser& argv) {
  pfi::lang::shared_ptr<jubatus::common::lock_service> ls_(
      jubatus::common::create_lock_service("zk", zkhosts, 10, "/dev/null"));

  vector<string> list;
  jubatus::framework::server_argv server_option;

  if (cmd == "start") {
    string path0 = name.substr(name.find_first_of("/") + 1);
    string path;
    jubatus::common::build_actor_path(
        path, type, path0.substr(0, path0.find_first_of("/")));
    ls_->create(path);
    path += "/nodes";
    ls_->create(path);

    server_option.bind_if = argv.get<std::string>("listen_if");
    server_option.threadnum = argv.get<int>("thread");
    server_option.timeout = argv.get<int>("timeout");
    server_option.program_name = type;
    server_option.z = zkhosts;
    server_option.name = name;
    server_option.datadir = argv.get<std::string>("datadir");
    server_option.logdir = argv.get<std::string>("logdir");
    server_option.loglevel = argv.get<int>("loglevel");
    server_option.join = argv.exist("join");

    server_option.interval_sec = argv.get<int>("interval_sec");
    server_option.interval_count = argv.get<int>("interval_count");
  }

  ls_->list(jubatus::common::JUBAVISOR_BASE_PATH, list);

  if (list.empty()) {
    LOG(INFO) << "no server to " << cmd << " " << name;
    exit(-1);
  }

  unsigned int N = argv.get<unsigned int>("num");
  if (N == 0) {
    N = list.size();
  }
  vector<string>::const_iterator it;
  unsigned int n = N / list.size();
  for (it = list.begin(); it != list.end(); ++it) {
    do_request(cmd, name, *it, n, server_option);
  }
  n = N % list.size();
  for (size_t i = 0; i < n; ++i) {
    do_request(cmd, name, *it, n, server_option);
  }
}
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
  {
    bool ignore = (parser.exist("ignore"));

    if(ignore)
    {
      std::cout << "Not fixing vulkan layer issues, and suppressing future warnings." << std::endl;
      std::cout << "To undo, remove '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;

      string ignorePath = string(getenv("HOME")) + "/.renderdoc/";

      mkdir(ignorePath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);

      ignorePath += "ignore_vulkan_layer";

      FILE *f = fopen(ignorePath.c_str(), "w");

      if(f)
      {
        fputs("This file suppresses any checks for vulkan layer issues.\n", f);
        fputs("Delete this file to restore default checking.\n", f);

        fclose(f);
      }
      else
      {
        std::cerr << "Couldn't create '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;
      }

      return 0;
    }

    RENDERDOC_UpdateVulkanLayerRegistration(parser.exist("system"));

    return 0;
  }
Exemple #5
0
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
  {
    string host = parser.get<string>("host");
    uint32_t port = parser.get<uint32_t>("port");

    std::cerr << "Spawning a replay host listening on " << (host.empty() ? "*" : host) << ":"
              << port << "..." << std::endl;

    if(parser.exist("daemon"))
    {
      std::cerr << "Detaching." << std::endl;
      Daemonise();
    }

    usingKillSignal = true;

    RENDERDOC_BecomeRemoteServer(host.empty() ? NULL : host.c_str(), port, &killSignal);

    std::cerr << std::endl << "Cleaning up from replay hosting." << std::endl;

    return 0;
  }
Exemple #6
0
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
  {
    if(parser.rest().empty())
    {
      std::cerr << "Error: capture command requires a filename to load." << std::endl
                << std::endl
                << parser.usage();
      return 0;
    }

    string filename = parser.rest()[0];

    if(parser.exist("remote-host"))
    {
      std::cout << "Replaying '" << filename << "' on " << parser.get<string>("remote-host") << ":"
                << parser.get<uint32_t>("remote-port") << "." << std::endl;

      RemoteServer *remote = NULL;
      ReplayCreateStatus status = RENDERDOC_CreateRemoteServerConnection(
          parser.get<string>("remote-host").c_str(), parser.get<uint32_t>("remote-port"), &remote);

      if(remote == NULL || status != eReplayCreate_Success)
      {
        std::cerr << "Error: Couldn't connect to " << parser.get<string>("remote-host") << ":"
                  << parser.get<uint32_t>("remote-port") << "." << std::endl;
        std::cerr << "       Have you run renderdoccmd remoteserver on '"
                  << parser.get<string>("remote-host") << "'?" << std::endl;
        return 1;
      }

      std::cerr << "Copying capture file to remote server" << std::endl;

      float progress = 0.0f;
      rdctype::str remotePath = remote->CopyCaptureToRemote(filename.c_str(), &progress);

      ReplayRenderer *renderer = NULL;
      status = remote->OpenCapture(~0U, remotePath.elems, &progress, &renderer);

      if(status == eReplayCreate_Success)
      {
        DisplayRendererPreview(renderer, parser.get<uint32_t>("width"),
                               parser.get<uint32_t>("height"));

        remote->CloseCapture(renderer);
      }
      else
      {
        std::cerr << "Couldn't load and replay '" << filename << "'." << std::endl;
      }

      remote->ShutdownConnection();
    }
    else
    {
      std::cout << "Replaying '" << filename << "' locally.." << std::endl;

      float progress = 0.0f;
      ReplayRenderer *renderer = NULL;
      ReplayCreateStatus status =
          RENDERDOC_CreateReplayRenderer(filename.c_str(), &progress, &renderer);

      if(status == eReplayCreate_Success)
      {
        DisplayRendererPreview(renderer, parser.get<uint32_t>("width"),
                               parser.get<uint32_t>("height"));

        renderer->Shutdown();
      }
      else
      {
        std::cerr << "Couldn't load and replay '" << filename << "'." << std::endl;
      }
    }
    return 0;
  }
  virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
  {
    bool ignore = (parser.exist("ignore"));

    if(ignore)
    {
      std::cout << "Not fixing vulkan layer issues, and suppressing future warnings." << std::endl;
      std::cout << "To undo, remove '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;

      string ignorePath = string(getenv("HOME")) + "/.renderdoc/";

      mkdir(ignorePath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);

      ignorePath += "ignore_vulkan_layer";

      FILE *f = fopen(ignorePath.c_str(), "w");

      if(f)
      {
        fputs("This file suppresses any checks for vulkan layer issues.\n", f);
        fputs("Delete this file to restore default checking.\n", f);

        fclose(f);
      }
      else
      {
        std::cerr << "Couldn't create '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;
      }

      return 0;
    }

    bool system = (parser.exist("system"));
    bool dryrun = (parser.exist("dry-run"));

    // if we want to install to the system and there's a registration in $HOME, delete it
    if(system && homeExists)
    {
      std::cout << "Removing '" << layerRegistrationPath[HOME] << "'" << std::endl;

      if(!dryrun)
      {
        int ret = unlink(layerRegistrationPath[HOME].c_str());

        if(ret < 0)
        {
          const char *const errtext = strerror(errno);
          std::cout << "Error - " << errtext << std::endl;
        }
      }
    }

    // and vice-versa
    if(!system && etcExists)
    {
      std::cout << "Removing '" << layerRegistrationPath[ETC] << "'" << std::endl;

      if(!dryrun)
      {
        int ret = unlink(layerRegistrationPath[ETC].c_str());

        if(ret < 0)
        {
          const char *const errtext = strerror(errno);
          std::cout << "Error - " << errtext << std::endl;
        }
      }
    }

    int idx = system ? ETC : HOME;

    string path = GetSOFromJSON(layerRegistrationPath[idx]);

    if(path != libPath)
    {
      if((system && !etcExists) || (!system && !homeExists))
      {
        std::cout << "Registering '" << layerRegistrationPath[idx] << "'" << std::endl;
      }
      else
      {
        std::cout << "Updating '" << layerRegistrationPath[idx] << "'" << std::endl;
        if(path == "")
        {
          std::cout << "  JSON is corrupt or unrecognised, replacing with valid JSON pointing"
                    << std::endl;
          std::cout << "  to '" << libPath << "'" << std::endl;
        }
        else
        {
          std::cout << "  Repointing from '" << path << "'" << std::endl;
          std::cout << "  to '" << libPath << "'" << std::endl;
        }
      }

      if(!dryrun)
      {
        FILE *f = fopen(layerRegistrationPath[idx].c_str(), "w");

        if(f)
        {
          fputs(GenerateJSON(libPath).c_str(), f);

          fclose(f);
        }
        else
        {
          const char *const errtext = strerror(errno);
          std::cout << "Error - " << errtext << std::endl;
        }
      }
    }

    return 0;
  }