<!DOCTYPE html>
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<title>LinuxPerfClockParser tests</title>
<script src="base.js"></script>
</head>
<body>
<script>
'use strict';

base.require('unittest');
base.require('test_utils');
base.require('linux_perf_importer');

function testClock() {
  var lines = [
  'cfinteractive-23    [000] d..2  8113.233768: clock_set_rate: ' + 
  'fout_apll state=500000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.249509: clock_set_rate: ' +
  'fout_apll state=300000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.289796: clock_set_rate: ' +
  'fout_apll state=400000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.294568: clock_set_rate: ' + 
  'fout_apll state=500000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.309509: clock_set_rate: ' + 
  'fout_apll state=800000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.388732: clock_set_rate: ' +
  'fout_apll state=200000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.410182: clock_set_rate: ' +
  'fout_apll state=300000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.414872: clock_set_rate: ' +
  'fout_apll state=600000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.494455: clock_set_rate: ' +
  'fout_apll state=200000000 cpu_id=0',
  
  'cfinteractive-23    [000] d..2  8113.515254: clock_set_rate: ' +
  'fout_apll state=500000000 cpu_id=0',
  ];

  var m = new tracing.TimelineModel(lines.join('\n'), false);
  assertEquals(0, m.importErrors.length);
  console.log(m);

  var counters = m.getAllCounters();
  console.log(counters);
  assertEquals(1, counters.length);

  assertEquals(10, counters[0].samples.length);
}

</script>
</body>
</html>