internal virtual void Collect()
            {
                TotalTimeMillis  = currentTimeMillis() - StartTime;
                StageVmPauseTime = VmPauseTimeAccumulator.PauseTime - BaseVmPauseTime;
                long lastDoneBatches = DoneBatches;

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (Step<?> step : execution.steps())
                foreach (Step <object> step in Execution.steps())
                {
                    StepStats stats           = step.Stats();
                    Stat      memoryUsageStat = stats.Stat(Keys.memory_usage);
                    if (memoryUsageStat != null)
                    {
                        MemoryUsage = max(MemoryUsage, memoryUsageStat.AsLong());
                    }
                    Stat ioStat = stats.Stat(Keys.io_throughput);
                    if (ioStat != null)
                    {
                        IoThroughput = ioStat.AsLong();
                    }
                    lastDoneBatches = stats.Stat(Keys.done_batches).asLong();
                }
                DoneBatches = lastDoneBatches;
            }
Ejemplo n.º 2
0
        public static void PrintSpectrum(StringBuilder builder, StageExecution execution, int width, DetailLevel additionalStatsLevel)
        {
            long[] values = values(execution);
            long   total  = total(values);

            // reduce the width with the known extra characters we know we'll print in and around the spectrum
            width -= 2 + PROGRESS_WIDTH;

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.helpers.collection.Pair<Step<?>,float> bottleNeck = execution.stepsOrderedBy(org.neo4j.unsafe.impl.batchimport.stats.Keys.avg_processing_time, false).iterator().next();
            Pair <Step <object>, float> bottleNeck = execution.StepsOrderedBy(Keys.avg_processing_time, false).GetEnumerator().next();
            QuantizedProjection         projection = new QuantizedProjection(total, width);
            long lastDoneBatches = 0;
            int  stepIndex       = 0;
            bool hasProgressed   = false;

            builder.Append('[');
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (Step<?> step : execution.steps())
            foreach (Step <object> step in execution.Steps())
            {
                StepStats stats = step.Stats();
                if (!projection.Next(values[stepIndex]))
                {
                    break;                              // odd though
                }
                long stepWidth = total == 0 && stepIndex == 0 ? width : projection.Step();
                if (stepWidth > 0)
                {
                    if (hasProgressed)
                    {
                        stepWidth--;
                        builder.Append('|');
                    }
                    bool   isBottleNeck   = bottleNeck.First() == step;
                    string name           = (isBottleNeck ? "*" : "") + stats.ToString(additionalStatsLevel) + (step.Processors(0) > 1 ? "(" + step.Processors(0) + ")" : "");
                    int    charIndex      = 0;                      // negative value "delays" the text, i.e. pushes it to the right
                    char   backgroundChar = step.Processors(0) > 1 ? '=' : '-';
                    for (int i = 0; i < stepWidth; i++, charIndex++)
                    {
                        char ch = backgroundChar;
                        if (charIndex >= 0 && charIndex < name.Length && charIndex < stepWidth)
                        {
                            ch = name[charIndex];
                        }
                        builder.Append(ch);
                    }
                    hasProgressed = true;
                }
                lastDoneBatches = stats.Stat(Keys.done_batches).asLong();
                stepIndex++;
            }

            long progress = lastDoneBatches * execution.Config.batchSize();

            builder.Append("]").Append(FitInProgress(progress));
        }