OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <math.h> | 5 #include <math.h> |
6 #include <cstdlib> | 6 #include <cstdlib> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 TRACE_EVENT_FLOW_STEP0("all", "TRACE_EVENT_FLOW_STEP0 call", | 452 TRACE_EVENT_FLOW_STEP0("all", "TRACE_EVENT_FLOW_STEP0 call", |
453 kFlowId, "step1"); | 453 kFlowId, "step1"); |
454 TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0("all", | 454 TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0("all", |
455 "TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0 call", kFlowId); | 455 "TRACE_EVENT_FLOW_END_BIND_TO_ENCLOSING0 call", kFlowId); |
456 | 456 |
457 TRACE_COUNTER1("all", "TRACE_COUNTER1 call", 31415); | 457 TRACE_COUNTER1("all", "TRACE_COUNTER1 call", 31415); |
458 TRACE_COUNTER2("all", "TRACE_COUNTER2 call", | 458 TRACE_COUNTER2("all", "TRACE_COUNTER2 call", |
459 "a", 30000, | 459 "a", 30000, |
460 "b", 1415); | 460 "b", 1415); |
461 | 461 |
| 462 TRACE_COUNTER_WITH_TIMESTAMP1("all", "TRACE_COUNTER_WITH_TIMESTAMP1 call", |
| 463 42, 31415); |
| 464 TRACE_COUNTER_WITH_TIMESTAMP2("all", "TRACE_COUNTER_WITH_TIMESTAMP2 call", |
| 465 42, "a", 30000, "b", 1415); |
| 466 |
462 TRACE_COUNTER_ID1("all", "TRACE_COUNTER_ID1 call", 0x319009, 31415); | 467 TRACE_COUNTER_ID1("all", "TRACE_COUNTER_ID1 call", 0x319009, 31415); |
463 TRACE_COUNTER_ID2("all", "TRACE_COUNTER_ID2 call", 0x319009, | 468 TRACE_COUNTER_ID2("all", "TRACE_COUNTER_ID2 call", 0x319009, |
464 "a", 30000, "b", 1415); | 469 "a", 30000, "b", 1415); |
465 | 470 |
466 TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0("all", | 471 TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0("all", |
467 "TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0 call", | 472 "TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0 call", |
468 kAsyncId, kThreadId, 12345); | 473 kAsyncId, kThreadId, 12345); |
469 TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0("all", | 474 TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0("all", |
470 "TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0 call", | 475 "TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0 call", |
471 kAsyncId, kThreadId, 23456); | 476 kAsyncId, kThreadId, 23456); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 EXPECT_EQ("C", ph); | 653 EXPECT_EQ("C", ph); |
649 | 654 |
650 int value; | 655 int value; |
651 EXPECT_TRUE((item && item->GetInteger("args.a", &value))); | 656 EXPECT_TRUE((item && item->GetInteger("args.a", &value))); |
652 EXPECT_EQ(30000, value); | 657 EXPECT_EQ(30000, value); |
653 | 658 |
654 EXPECT_TRUE((item && item->GetInteger("args.b", &value))); | 659 EXPECT_TRUE((item && item->GetInteger("args.b", &value))); |
655 EXPECT_EQ(1415, value); | 660 EXPECT_EQ(1415, value); |
656 } | 661 } |
657 | 662 |
| 663 EXPECT_FIND_("TRACE_COUNTER_WITH_TIMESTAMP1 call"); |
| 664 { |
| 665 std::string ph; |
| 666 EXPECT_TRUE((item && item->GetString("ph", &ph))); |
| 667 EXPECT_EQ("C", ph); |
| 668 |
| 669 int value; |
| 670 EXPECT_TRUE((item && item->GetInteger("args.value", &value))); |
| 671 EXPECT_EQ(31415, value); |
| 672 |
| 673 int ts; |
| 674 EXPECT_TRUE((item && item->GetInteger("ts", &ts))); |
| 675 EXPECT_EQ(42, ts); |
| 676 } |
| 677 |
| 678 EXPECT_FIND_("TRACE_COUNTER_WITH_TIMESTAMP2 call"); |
| 679 { |
| 680 std::string ph; |
| 681 EXPECT_TRUE((item && item->GetString("ph", &ph))); |
| 682 EXPECT_EQ("C", ph); |
| 683 |
| 684 int value; |
| 685 EXPECT_TRUE((item && item->GetInteger("args.a", &value))); |
| 686 EXPECT_EQ(30000, value); |
| 687 |
| 688 EXPECT_TRUE((item && item->GetInteger("args.b", &value))); |
| 689 EXPECT_EQ(1415, value); |
| 690 |
| 691 int ts; |
| 692 EXPECT_TRUE((item && item->GetInteger("ts", &ts))); |
| 693 EXPECT_EQ(42, ts); |
| 694 } |
| 695 |
658 EXPECT_FIND_("TRACE_COUNTER_ID1 call"); | 696 EXPECT_FIND_("TRACE_COUNTER_ID1 call"); |
659 { | 697 { |
660 std::string id; | 698 std::string id; |
661 EXPECT_TRUE((item && item->GetString("id", &id))); | 699 EXPECT_TRUE((item && item->GetString("id", &id))); |
662 EXPECT_EQ("0x319009", id); | 700 EXPECT_EQ("0x319009", id); |
663 | 701 |
664 std::string ph; | 702 std::string ph; |
665 EXPECT_TRUE((item && item->GetString("ph", &ph))); | 703 EXPECT_TRUE((item && item->GetString("ph", &ph))); |
666 EXPECT_EQ("C", ph); | 704 EXPECT_EQ("C", ph); |
667 | 705 |
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2993 } | 3031 } |
2994 | 3032 |
2995 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 3033 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
2996 const char filter[] = "DELAY(test.Delay;16;oneshot)"; | 3034 const char filter[] = "DELAY(test.Delay;16;oneshot)"; |
2997 TraceConfig config(filter, ""); | 3035 TraceConfig config(filter, ""); |
2998 EXPECT_EQ(filter, config.ToCategoryFilterString()); | 3036 EXPECT_EQ(filter, config.ToCategoryFilterString()); |
2999 } | 3037 } |
3000 | 3038 |
3001 } // namespace trace_event | 3039 } // namespace trace_event |
3002 } // namespace base | 3040 } // namespace base |
OLD | NEW |