예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static java.util.stream.Stream<RetrieveResult> retrieve(String graphToken, org.neo4j.internal.kernel.api.Kernel kernel, long numSilentQueryDrops) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        internal static Stream <RetrieveResult> Retrieve(string graphToken, Kernel kernel, long numSilentQueryDrops)
        {
            IDictionary <string, object> systemData = new Dictionary <string, object>();

            systemData["jvmMemoryFree"]                = Runtime.Runtime.freeMemory();
            systemData["jvmMemoryTotal"]               = Runtime.Runtime.totalMemory();
            systemData["jvmMemoryMax"]                 = Runtime.Runtime.maxMemory();
            systemData["systemTotalPhysicalMemory"]    = OsBeanUtil.TotalPhysicalMemory;
            systemData["systemFreePhysicalMemory"]     = OsBeanUtil.FreePhysicalMemory;
            systemData["systemCommittedVirtualMemory"] = OsBeanUtil.CommittedVirtualMemory;
            systemData["systemTotalSwapSpace"]         = OsBeanUtil.TotalSwapSpace;
            systemData["systemFreeSwapSpace"]          = OsBeanUtil.FreeSwapSpace;

            OperatingSystemMXBean os = ManagementFactory.OperatingSystemMXBean;

            systemData["osArch"]              = os.Arch;
            systemData["osName"]              = os.Name;
            systemData["osVersion"]           = os.Version;
            systemData["availableProcessors"] = os.AvailableProcessors;
            systemData["byteOrder"]           = ByteOrder.nativeOrder().ToString();

            RuntimeMXBean runtime = ManagementFactory.RuntimeMXBean;

            systemData["jvmName"]    = runtime.VmName;
            systemData["jvmVendor"]  = runtime.VmVendor;
            systemData["jvmVersion"] = runtime.VmVersion;
            CompilationMXBean compiler = ManagementFactory.CompilationMXBean;

            systemData["jvmJITCompiler"] = compiler == null ? "unknown" : compiler.Name;

            systemData["userLanguage"] = Locale.Default.Language;
            systemData["userCountry"]  = Locale.Default.Country;
            systemData["userTimezone"] = TimeZone.Default.ID;
            systemData["fileEncoding"] = System.getProperty("file.encoding");

            IDictionary <string, object> internalData = new Dictionary <string, object>();

            internalData["numSilentQueryCollectionMisses"] = numSilentQueryDrops;

            IDictionary <string, object> metaData = new Dictionary <string, object>();

            metaData["graphToken"]   = graphToken;
            metaData["retrieveTime"] = ZonedDateTime.now();
            metaData["system"]       = systemData;
            metaData["internal"]     = internalData;

            TokensSection.PutTokenCounts(metaData, kernel);

            return(Stream.of(new RetrieveResult(Sections.META, metaData)));
        }
예제 #2
0
        public virtual Stream <RetrieveResult> Retrieve(string section, IDictionary <string, object> config)
        {
            string upperSection = section.ToUpper();

            switch (upperSection)
            {
            case Sections.GRAPH_COUNTS:
                return(GraphCountsSection.Retrieve(DataCollector.kernel, Anonymizer.PLAIN_TEXT));

            case Sections.TOKENS:
                return(TokensSection.Retrieve(DataCollector.kernel));

            case Sections.META:
                return(MetaSection.Retrieve(null, DataCollector.kernel, DataCollector.queryCollector.numSilentQueryDrops()));

            case Sections.QUERIES:
                return(QueriesSection.retrieve(DataCollector.queryCollector.Data, new PlainText(DataCollector.valueMapper), RetrieveConfig.Of(config).MaxInvocations));

            default:
                throw Sections.UnknownSectionException(section);
            }
        }