MCPcopy Create free account
hub / github.com/apple/foundationdb / openTraceFile

Function openTraceFile

flow/Trace.cpp:750–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748}
749
750void openTraceFile(const NetworkAddress& na,
751 uint64_t rollsize,
752 uint64_t maxLogsSize,
753 std::string directory,
754 std::string baseOfBase,
755 std::string logGroup,
756 std::string identifier,
757 std::string tracePartialFileSuffix) {
758 if (g_traceLog.isOpen())
759 return;
760
761 if (directory.empty())
762 directory = ".";
763
764 if (baseOfBase.empty())
765 baseOfBase = "trace";
766
767 std::string ip = na.ip.toString();
768 std::replace(ip.begin(), ip.end(), ':', '_'); // For IPv6, Windows doesn't accept ':' in filenames.
769 std::string baseName;
770 if (identifier.size() > 0) {
771 baseName = format("%s.%s.%s", baseOfBase.c_str(), ip.c_str(), identifier.c_str());
772 } else {
773 baseName = format("%s.%s.%d", baseOfBase.c_str(), ip.c_str(), na.port);
774 }
775 g_traceLog.open(directory,
776 baseName,
777 logGroup,
778 format("%lld", time(nullptr)),
779 rollsize,
780 maxLogsSize,
781 !g_network->isSimulated() ? na : Optional<NetworkAddress>(),
782 tracePartialFileSuffix);
783
784 uncancellable(recurring(&flushTraceFile, FLOW_KNOBS->TRACE_FLUSH_INTERVAL, TaskPriority::FlushTrace));
785 g_traceBatch.dump();
786}
787
788void initTraceEventMetrics() {
789 g_traceLog.initMetrics();

Callers 8

mainFunction · 0.85
mainFunction · 0.85
fdb_flow_testFunction · 0.85
runHostFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
createDatabaseMethod · 0.85

Calls 12

uncancellableFunction · 0.85
formatFunction · 0.70
openMethod · 0.65
isOpenMethod · 0.45
emptyMethod · 0.45
toStringMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
isSimulatedMethod · 0.45
dumpMethod · 0.45

Tested by 1

runHostFunction · 0.68