MCPcopy Create free account
hub / github.com/apache/impala / HandleCommonFlags

Function HandleCommonFlags

be/src/kudu/util/flags.cc:506–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506void HandleCommonFlags() {
507 if (FLAGS_helpxml) {
508 DumpFlagsXML();
509 exit(1);
510 } else if (FLAGS_dump_metrics_json) {
511 MetricPrototypeRegistry::get()->WriteAsJson();
512 exit(0);
513 } else if (FLAGS_dump_metrics_xml) {
514 MetricPrototypeRegistry::get()->WriteAsXML();
515 exit(0);
516 } else if (FLAGS_version) {
517 cout << VersionInfo::GetAllVersionInfo() << endl;
518 exit(0);
519 }
520
521 google::HandleCommandLineHelpFlags();
522
523 if (FLAGS_disable_core_dumps) {
524 DisableCoreDumps();
525 }
526
527 SetUmask();
528
529#ifdef TCMALLOC_ENABLED
530 if (FLAGS_heap_profile_path.empty()) {
531 FLAGS_heap_profile_path = strings::Substitute(
532 "/tmp/$0.$1", google::ProgramInvocationShortName(), getpid());
533 }
534
535 if (FLAGS_enable_process_lifetime_heap_profiling) {
536 HeapProfilerStart(FLAGS_heap_profile_path.c_str());
537 }
538 // Set the internal tcmalloc flag unless it was already set using the built-in
539 // environment-variable-based method. It doesn't appear that this is settable
540 // in any less hacky fashion.
541 if (!getenv("TCMALLOC_SAMPLE_PARAMETER")) {
542 TCM_NAMESPACE::FLAGS_tcmalloc_sample_parameter = FLAGS_heap_sample_every_n_bytes;
543 } else if (!google::GetCommandLineFlagInfoOrDie("heap_sample_every_n_bytes").is_default) {
544 LOG(ERROR) << "Heap sampling configured using both --heap-sample-every-n-bytes and "
545 << "TCMALLOC_SAMPLE_PARAMETER. Ignoring command line flag.";
546 }
547#endif
548}
549
550void ValidateFlags() {
551 CheckFlagsAllowed();

Callers 1

ParseCommandLineFlagsFunction · 0.85

Calls 7

DumpFlagsXMLFunction · 0.85
DisableCoreDumpsFunction · 0.85
SetUmaskFunction · 0.85
SubstituteFunction · 0.85
WriteAsJsonMethod · 0.80
WriteAsXMLMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected