Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: tracing/tracing/mre/map_single_trace_unittest.py

Issue 2353083003: [Tracing] Use 8gb of heap space for map_single_trace commandline (Closed)
Patch Set: Remove debugging code Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/mre/map_single_trace.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/mre/map_single_trace_unittest.py
diff --git a/tracing/tracing/mre/map_single_trace_unittest.py b/tracing/tracing/mre/map_single_trace_unittest.py
index 937f3b0144cd93b1cb2a910de64a17f51f48e45f..44744aa6b893c42d87bcc650c925fa9b24891518 100644
--- a/tracing/tracing/mre/map_single_trace_unittest.py
+++ b/tracing/tracing/mre/map_single_trace_unittest.py
@@ -46,6 +46,42 @@ class MapSingleTraceTests(unittest.TestCase):
r = result.pairs['result']
self.assertEquals(r['numProcesses'], 1)
+
+ def testProcessingGiantTrace(self):
+ # Populate a string trace of 2 million events.
+ trace_events = ['[']
+ for i in xrange(2000000):
+ trace_events.append(
+ '{"pid": 1, "tid": %i, "ph": "X", "name": "a", "cat": "c",'
+ '"ts": %i, "dur": 1, "args": {}},' % (i % 5, 2 * i))
+ trace_events.append('{}]')
+ trace_data = ''.join(trace_events)
+ trace_handle = file_handle.InMemoryFileHandle(
+ '/a.json', trace_data)
+
+ with map_single_trace.TemporaryMapScript("""
+ tr.mre.FunctionRegistry.register(
+ function MyMapFunction(result, model) {
+ var canonicalUrl = model.canonicalUrl;
+ var numEvents = 0;
+ for (var e of model.getProcess(1).getDescendantEvents()) {
+ numEvents++;
+ }
+ result.addPair('result', {
+ numEvents: numEvents
+ });
+ });
+ """) as map_script:
+ result = map_single_trace.MapSingleTrace(trace_handle,
+ _Handle(map_script.filename))
+
+ self.assertFalse(result.failures,
+ msg='\n'.join(str(f) for f in result.failures))
+ r = result.pairs['result']
+ self.assertEquals(r['numEvents'], 2000000)
+
+
+
def testTraceDidntImport(self):
trace_string = 'This is intentionally not a trace-formatted string.'
trace_handle = file_handle.InMemoryFileHandle(
« no previous file with comments | « tracing/tracing/mre/map_single_trace.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698