public virtual void TestWriteWithLegacyNames() { Counters counters = new Counters(); counters.IncrCounter(Task.Counter.MapInputRecords, 1); counters.IncrCounter(JobInProgress.Counter.DataLocalMaps, 1); counters.FindCounter("FileSystemCounters", "FILE_BYTES_READ").Increment(1); CheckLegacyNames(counters); }
public virtual void TestReadWithLegacyNames() { Counters counters = new Counters(); counters.IncrCounter(TaskCounter.MapInputRecords, 1); counters.IncrCounter(JobCounter.DataLocalMaps, 1); counters.FindCounter("file", FileSystemCounter.BytesRead).Increment(1); CheckLegacyNames(counters); }
public virtual void TestCounterIteratorConcurrency() { Counters counters = new Counters(); counters.IncrCounter("group1", "counter1", 1); IEnumerator <Counters.Group> iterator = counters.GetEnumerator(); counters.IncrCounter("group2", "counter2", 1); iterator.Next(); }
public virtual void TestOldCounters() { Counters c1 = new Counters(); c1.IncrCounter(FileInputFormat.Counter.BytesRead, 100); c1.IncrCounter(FileOutputFormat.Counter.BytesWritten, 200); c1.IncrCounter(TaskCounter.MapOutputBytes, 100); c1.IncrCounter(TaskCounter.MapOutputMaterializedBytes, 100); ValidateFileCounters(c1, 100, 200, 100, 100); ValidateOldFileCounters(c1, 100, 200, 100, 100); }
public virtual void TestGroupIteratorConcurrency() { Counters counters = new Counters(); counters.IncrCounter("group1", "counter1", 1); Counters.Group group = counters.GetGroup("group1"); IEnumerator <Counters.Counter> iterator = group.GetEnumerator(); counters.IncrCounter("group1", "counter2", 1); iterator.Next(); }
public virtual void TestMakeCompactString() { string Gc1 = "group1.counter1:1"; string Gc2 = "group2.counter2:3"; Counters counters = new Counters(); counters.IncrCounter("group1", "counter1", 1); NUnit.Framework.Assert.AreEqual("group1.counter1:1", counters.MakeCompactString() ); counters.IncrCounter("group2", "counter2", 3); string cs = counters.MakeCompactString(); NUnit.Framework.Assert.IsTrue("Bad compact string", cs.Equals(Gc1 + ',' + Gc2) || cs.Equals(Gc2 + ',' + Gc1)); }
// Generates enum based counters private Counters GetEnumCounters(Enum[] keys) { Counters counters = new Counters(); foreach (Enum key in keys) { for (long i = 0; i < MaxValue; ++i) { counters.IncrCounter(key, i); } } return(counters); }
// Generate string based counters private Counters GetEnumCounters(string[] gNames, string[] cNames) { Counters counters = new Counters(); foreach (string gName in gNames) { foreach (string cName in cNames) { for (long i = 0; i < MaxValue; ++i) { counters.IncrCounter(gName, cName, i); } } } return(counters); }
public virtual void TestLegacyGetGroupNames() { Counters counters = new Counters(); // create 2 filesystem counter groups counters.FindCounter("fs1", FileSystemCounter.BytesRead).Increment(1); counters.FindCounter("fs2", FileSystemCounter.BytesRead).Increment(1); counters.IncrCounter("group1", "counter1", 1); HashSet <string> groups = new HashSet <string>(((ICollection <string>)counters.GetGroupNames ())); HashSet <string> expectedGroups = new HashSet <string>(); expectedGroups.AddItem("group1"); expectedGroups.AddItem("FileSystemCounters"); //Legacy Name expectedGroups.AddItem("org.apache.hadoop.mapreduce.FileSystemCounter"); NUnit.Framework.Assert.AreEqual(expectedGroups, groups); }