| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 9 #include "gpu/command_buffer/service/gpu_service_test.h" | 9 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 10 #include "gpu/command_buffer/service/gpu_tracer.h" | 10 #include "gpu/command_buffer/service/gpu_tracer.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // Each trace name should be different to differentiate. | 520 // Each trace name should be different to differentiate. |
| 521 const char num_char = static_cast<char>('0' + i); | 521 const char num_char = static_cast<char>('0' + i); |
| 522 std::string source_category = category_name + num_char; | 522 std::string source_category = category_name + num_char; |
| 523 std::string source_trace_name = trace_name + num_char; | 523 std::string source_trace_name = trace_name + num_char; |
| 524 | 524 |
| 525 ExpectOutputterBeginMocks(outputter_ref_.get(), | 525 ExpectOutputterBeginMocks(outputter_ref_.get(), |
| 526 source_category, source_trace_name); | 526 source_category, source_trace_name); |
| 527 | 527 |
| 528 const GpuTracerSource source = static_cast<GpuTracerSource>(i); | 528 const GpuTracerSource source = static_cast<GpuTracerSource>(i); |
| 529 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source)); | 529 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source)); |
| 530 | |
| 531 ASSERT_EQ(source_category, tracer.CurrentCategory()); | |
| 532 ASSERT_EQ(source_trace_name, tracer.CurrentName()); | |
| 533 } | 530 } |
| 534 | 531 |
| 535 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) { | 532 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) { |
| 536 // Set times so each source has a different time. | 533 // Set times so each source has a different time. |
| 537 gl_fake_queries_.SetCurrentGLTime( | 534 gl_fake_queries_.SetCurrentGLTime( |
| 538 end_timestamp + | 535 end_timestamp + |
| 539 (i * base::Time::kNanosecondsPerMicrosecond)); | 536 (i * base::Time::kNanosecondsPerMicrosecond)); |
| 540 cpu_time_ref_->SetFakeCPUTime(expect_end_time + i); | 537 cpu_time_ref_->SetFakeCPUTime(expect_end_time + i); |
| 541 | 538 |
| 542 // Each trace name should be different to differentiate. | 539 // Each trace name should be different to differentiate. |
| 543 const char num_char = static_cast<char>('0' + i); | 540 const char num_char = static_cast<char>('0' + i); |
| 544 std::string source_category = category_name + num_char; | 541 std::string source_category = category_name + num_char; |
| 545 std::string source_trace_name = trace_name + num_char; | 542 std::string source_trace_name = trace_name + num_char; |
| 546 | 543 |
| 547 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, | 544 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, |
| 548 source_trace_name, | 545 source_trace_name, |
| 549 expect_start_time + i, expect_end_time + i, | 546 expect_start_time + i, expect_end_time + i, |
| 550 GetTracerType() != kTracerTypeInvalid); | 547 GetTracerType() != kTracerTypeInvalid); |
| 551 | 548 |
| 552 const GpuTracerSource source = static_cast<GpuTracerSource>(i); | 549 const GpuTracerSource source = static_cast<GpuTracerSource>(i); |
| 550 |
| 551 // Check if the current category/name are correct for this source. |
| 552 ASSERT_EQ(source_category, tracer.CurrentCategory(source)); |
| 553 ASSERT_EQ(source_trace_name, tracer.CurrentName(source)); |
| 554 |
| 553 ASSERT_TRUE(tracer.End(source)); | 555 ASSERT_TRUE(tracer.End(source)); |
| 554 } | 556 } |
| 555 | 557 |
| 556 ASSERT_TRUE(tracer.EndDecoding()); | 558 ASSERT_TRUE(tracer.EndDecoding()); |
| 557 | 559 |
| 558 outputter_ref_ = NULL; | 560 outputter_ref_ = NULL; |
| 559 cpu_time_ref_ = NULL; | 561 cpu_time_ref_ = NULL; |
| 560 } | 562 } |
| 561 | 563 |
| 562 void DoDisjointTest() { | 564 void DoDisjointTest() { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 kTraceGroupMarker)); | 691 kTraceGroupMarker)); |
| 690 | 692 |
| 691 ASSERT_TRUE(tracer_tester.BeginDecoding()); | 693 ASSERT_TRUE(tracer_tester.BeginDecoding()); |
| 692 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, | 694 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, |
| 693 kTraceGroupMarker)); | 695 kTraceGroupMarker)); |
| 694 ASSERT_TRUE(tracer_tester.EndDecoding()); | 696 ASSERT_TRUE(tracer_tester.EndDecoding()); |
| 695 } | 697 } |
| 696 | 698 |
| 697 } // namespace gles2 | 699 } // namespace gles2 |
| 698 } // namespace gpu | 700 } // namespace gpu |
| OLD | NEW |