示例#1
0
        public void DoOperation(T snapshot, TestOperationLogger logger)
        {
            MemoryEntry entry = snapshotEntry.ReadMemory(snapshot);

            logger.WriteLine("READ: {0}", snapshotEntry);
            logger.WriteLine(entry.ToString());
            logger.WriteLine("------------------------------------------------");
        }
示例#2
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     if (temporaryIndex != null)
     {
         return("temporary data: " + temporaryIndex.ToString());
     }
     else
     {
         return("temporary data: " + dataEntry.ToString());
     }
 }
示例#3
0
        /// <summary>
        /// Read memory represented by current snapshot entry
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <returns>
        /// Memory represented by current snapshot entry
        /// </returns>
        protected override MemoryEntry readMemory(SnapshotBase context)
        {
            Snapshot snapshot = ToSnapshot(context);

            snapshot.Factories.Logger.Log(snapshot, "read: " + this.ToString());
            snapshot.Factories.Benchmark.StartOperation(snapshot);

            snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.READ);
            MemoryEntry entry = snapshot.Algorithms.ReadAlgorithm.Read(snapshot, path);

            snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.READ);

            snapshot.Factories.Benchmark.FinishOperation(snapshot);

            snapshot.Factories.Logger.LogToSameLine(" value: " + entry.ToString());
            return(entry);
        }
示例#4
0
        /// <summary>
        /// Read memory represented by current snapshot entry
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <returns>
        /// Memory represented by current snapshot entry
        /// </returns>
        protected override MemoryEntry readMemory(SnapshotBase context)
        {
            Snapshot snapshot = ToSnapshot(context);

            SnapshotLogger.append(context, "read: " + this.ToString());

            ReadCollector collector = new ReadCollector(snapshot);

            collector.ProcessPath(path);

            ReadWorker  worker = new ReadWorker(snapshot);
            MemoryEntry entry  = worker.ReadValue(collector);

            SnapshotLogger.appendToSameLine(" value: " + entry.ToString());

            return(entry);
        }
示例#5
0
        /// <summary>
        /// Write given value at memory represented by snapshot entry
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <param name="value">Written value</param>
        /// <param name="forceStrongWrite">Determine that current write should be processed as strong</param>
        /// <exception cref="System.NotSupportedException">Current mode:  + snapshot.CurrentMode</exception>
        protected override void writeMemory(SnapshotBase context, MemoryEntry value, bool forceStrongWrite)
        {
            Snapshot snapshot = ToSnapshot(context);

            snapshot.Factories.Logger.Log(snapshot, "write: " + this.ToString() + " value: " + value.ToString());
            snapshot.Factories.Benchmark.StartOperation(snapshot);

            snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.WRITE);
            snapshot.Algorithms.AssignAlgorithm.Assign(snapshot, path, value, forceStrongWrite);
            snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.WRITE);

            snapshot.Factories.Benchmark.FinishOperation(snapshot);
        }
示例#6
0
        /// <summary>
        /// Write given value at memory represented by snapshot entry
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <param name="value">Written value</param>
        /// <param name="forceStrongWrite">Determine that current write should be processed as strong</param>
        /// <exception cref="System.NotSupportedException">Current mode:  + snapshot.CurrentMode</exception>
        protected override void writeMemory(SnapshotBase context, MemoryEntry value, bool forceStrongWrite)
        {
            Snapshot snapshot = ToSnapshot(context);

            SnapshotLogger.append(context, "write: " + this.ToString() + " value: " + value.ToString());

            switch (snapshot.CurrentMode)
            {
            case SnapshotMode.MemoryLevel:
                writeMemoryNormal(snapshot, value, forceStrongWrite);
                break;

            case SnapshotMode.InfoLevel:
                writeMemoryInfo(snapshot, value, forceStrongWrite);
                break;

            default:
                throw new NotSupportedException("Current mode: " + snapshot.CurrentMode);
            }
        }