Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / importer / linux_perf / drm_parser.html
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
7
8 <link rel="import" href="/tracing/importer/linux_perf/parser.html">
9
10 <script>
11 'use strict';
12
13 /**
14  * @fileoverview Parses drm driver events in the Linux event trace format.
15  */
16 tv.exportTo('tracing.importer.linux_perf', function() {
17
18   var Parser = tracing.importer.linux_perf.Parser;
19
20   /**
21    * Parses linux drm trace events.
22    * @constructor
23    */
24   function DrmParser(importer) {
25     Parser.call(this, importer);
26
27     importer.registerEventHandler('drm_vblank_event',
28         DrmParser.prototype.vblankEvent.bind(this));
29   }
30
31   DrmParser.prototype = {
32     __proto__: Parser.prototype,
33
34     drmVblankSlice: function(ts, eventName, args) {
35       var kthread = this.importer.getOrCreatePseudoThread('drm_vblank');
36       kthread.openSlice = eventName;
37       var slice = new tracing.trace_model.Slice('', kthread.openSlice,
38           tv.ui.getStringColorId(kthread.openSlice), ts, args, 0);
39
40       kthread.thread.sliceGroup.pushSlice(slice);
41     },
42
43     /**
44      * Parses drm driver events and sets up state in the importer.
45      */
46     vblankEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
47       var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details);
48       if (!event)
49         return false;
50
51       var crtc = parseInt(event[1]);
52       var seq = parseInt(event[2]);
53       this.drmVblankSlice(ts, 'vblank:' + crtc,
54           {
55             crtc: crtc,
56             seq: seq
57           });
58       return true;
59     }
60   };
61
62   Parser.registerSubtype(DrmParser);
63
64   return {
65     DrmParser: DrmParser
66   };
67 });
68 </script>
69