|
@@ -585,229 +585,3 @@ func TestSetMain(t *testing.T) {
|
585
|
585
|
t.Errorf("got %s for main", testProfile.Mapping[0].File)
|
586
|
586
|
}
|
587
|
587
|
}
|
588
|
|
-
|
589
|
|
-// Benchmarks
|
590
|
|
-
|
591
|
|
-// benchmarkMerge measures the overhead of merging profiles read from files.
|
592
|
|
-// They must be the same type of profiles.
|
593
|
|
-func benchmarkMerge(b *testing.B, files []string) {
|
594
|
|
- const path = "testdata/"
|
595
|
|
-
|
596
|
|
- p := make([]*Profile, len(files))
|
597
|
|
-
|
598
|
|
- for i, source := range files {
|
599
|
|
- inBytes, err := ioutil.ReadFile(filepath.Join(path, source))
|
600
|
|
- if err != nil {
|
601
|
|
- b.Fatal(err)
|
602
|
|
- }
|
603
|
|
- if p[i], err = Parse(bytes.NewBuffer(inBytes)); err != nil {
|
604
|
|
- b.Fatalf("%s: %s", source, err)
|
605
|
|
- }
|
606
|
|
- }
|
607
|
|
-
|
608
|
|
- var prof *Profile
|
609
|
|
- b.ResetTimer()
|
610
|
|
- for i := 0; i < b.N; i++ {
|
611
|
|
- prof, _ = Merge(p)
|
612
|
|
- }
|
613
|
|
- b.StopTimer()
|
614
|
|
-
|
615
|
|
- before := 0
|
616
|
|
- for _, p := range p {
|
617
|
|
- p.preEncode()
|
618
|
|
- buff := marshal(p)
|
619
|
|
- before += len(buff)
|
620
|
|
- }
|
621
|
|
- prof.preEncode()
|
622
|
|
- buff := marshal(prof)
|
623
|
|
- after := len(buff)
|
624
|
|
- b.Logf("Profile size before merge = %v, After merge = %v", before, after)
|
625
|
|
-}
|
626
|
|
-
|
627
|
|
-// BenchmarkMergeCppCPUMedium measures the overhead of merging two medium CPU
|
628
|
|
-// profiles of a C++ program (muppet).
|
629
|
|
-func BenchmarkMergeCppCPUMedium(b *testing.B) {
|
630
|
|
- files := []string{
|
631
|
|
- "muppet.profilez.medium.1.pb.gz",
|
632
|
|
- "muppet.profilez.medium.2.pb.gz",
|
633
|
|
- }
|
634
|
|
-
|
635
|
|
- benchmarkMerge(b, files)
|
636
|
|
-}
|
637
|
|
-
|
638
|
|
-// BenchmarkMergeCppHeapMedium measures the overhead of merging two medium Heap
|
639
|
|
-// profiles of a C++ program (muppet).
|
640
|
|
-func BenchmarkMergeCppHeapMedium(b *testing.B) {
|
641
|
|
- files := []string{
|
642
|
|
- "muppet.heapz.medium.1.pb.gz",
|
643
|
|
- "muppet.heapz.medium.2.pb.gz",
|
644
|
|
- }
|
645
|
|
-
|
646
|
|
- benchmarkMerge(b, files)
|
647
|
|
-}
|
648
|
|
-
|
649
|
|
-// BenchmarkMergeCppContentionMedium measures the overhead of merging two medium
|
650
|
|
-// contention profiles of a C++ program (muppet).
|
651
|
|
-func BenchmarkMergeCppContentionMedium(b *testing.B) {
|
652
|
|
- files := []string{
|
653
|
|
- "muppet.contentionz.medium.1.pb.gz",
|
654
|
|
- "muppet.contentionz.medium.2.pb.gz",
|
655
|
|
- }
|
656
|
|
-
|
657
|
|
- benchmarkMerge(b, files)
|
658
|
|
-}
|
659
|
|
-
|
660
|
|
-// BenchmarkMergeJavaCPUMedium measures the overhead of merging two medium CPU
|
661
|
|
-// profiles of a Java program (caribou).
|
662
|
|
-func BenchmarkMergeJavaCPUMedium(b *testing.B) {
|
663
|
|
- files := []string{
|
664
|
|
- "caribou.profilez.medium.1.pb.gz",
|
665
|
|
- "caribou.profilez.medium.2.pb.gz",
|
666
|
|
- }
|
667
|
|
-
|
668
|
|
- benchmarkMerge(b, files)
|
669
|
|
-}
|
670
|
|
-
|
671
|
|
-// BenchmarkMergeJavaHeapMedium measures the overhead of merging two medium Heap
|
672
|
|
-// profiles of a Java program (caribou).
|
673
|
|
-func BenchmarkMergeJavaHeapMedium(b *testing.B) {
|
674
|
|
- files := []string{
|
675
|
|
- "caribou.heapz.medium.1.pb.gz",
|
676
|
|
- "caribou.heapz.medium.2.pb.gz",
|
677
|
|
- }
|
678
|
|
-
|
679
|
|
- benchmarkMerge(b, files)
|
680
|
|
-}
|
681
|
|
-
|
682
|
|
-// BenchmarkMergeJavaContentionMedium measures the overhead of merging two medium
|
683
|
|
-// contention profiles of a Java program (caribou).
|
684
|
|
-func BenchmarkMergeJavaContentionMedium(b *testing.B) {
|
685
|
|
- files := []string{
|
686
|
|
- "caribou.contentionz.medium.1.pb.gz",
|
687
|
|
- "caribou.contentionz.medium.2.pb.gz",
|
688
|
|
- }
|
689
|
|
-
|
690
|
|
- benchmarkMerge(b, files)
|
691
|
|
-}
|
692
|
|
-
|
693
|
|
-// BenchmarkMergeCppCPULarge measures the overhead of merging two large CPU
|
694
|
|
-// profiles of a C++ program (muppet).
|
695
|
|
-func BenchmarkMergeCppCPULarge(b *testing.B) {
|
696
|
|
- files := []string{
|
697
|
|
- "muppet.profilez.large.1.pb.gz",
|
698
|
|
- "muppet.profilez.large.2.pb.gz",
|
699
|
|
- }
|
700
|
|
-
|
701
|
|
- benchmarkMerge(b, files)
|
702
|
|
-}
|
703
|
|
-
|
704
|
|
-// BenchmarkMergeCppHeapLarge measures the overhead of merging two large Heap
|
705
|
|
-// profiles of a C++ program (muppet).
|
706
|
|
-func BenchmarkMergeCppHeapLarge(b *testing.B) {
|
707
|
|
- files := []string{
|
708
|
|
- "muppet.heapz.large.1.pb.gz",
|
709
|
|
- "muppet.heapz.large.2.pb.gz",
|
710
|
|
- }
|
711
|
|
-
|
712
|
|
- benchmarkMerge(b, files)
|
713
|
|
-}
|
714
|
|
-
|
715
|
|
-// BenchmarkMergeCppContentionLarge measures the overhead of merging two large
|
716
|
|
-// contention profiles of a C++ program (muppet).
|
717
|
|
-func BenchmarkMergeCppContentionLarge(b *testing.B) {
|
718
|
|
- files := []string{
|
719
|
|
- "muppet.contentionz.large.1.pb.gz",
|
720
|
|
- "muppet.contentionz.large.2.pb.gz",
|
721
|
|
- }
|
722
|
|
-
|
723
|
|
- benchmarkMerge(b, files)
|
724
|
|
-}
|
725
|
|
-
|
726
|
|
-// BenchmarkMergeJavaCPULarge measures the overhead of merging two large CPU
|
727
|
|
-// profiles of a Java program (caribou).
|
728
|
|
-func BenchmarkMergeJavaCPULarge(b *testing.B) {
|
729
|
|
- files := []string{
|
730
|
|
- "caribou.profilez.large.1.pb.gz",
|
731
|
|
- "caribou.profilez.large.2.pb.gz",
|
732
|
|
- }
|
733
|
|
-
|
734
|
|
- benchmarkMerge(b, files)
|
735
|
|
-}
|
736
|
|
-
|
737
|
|
-// BenchmarkMergeJavaHeapLarge measures the overhead of merging two large Heap
|
738
|
|
-// profiles of a Java program (caribou).
|
739
|
|
-func BenchmarkMergeJavaHeapLarge(b *testing.B) {
|
740
|
|
- files := []string{
|
741
|
|
- "caribou.heapz.large.1.pb.gz",
|
742
|
|
- "caribou.heapz.large.2.pb.gz",
|
743
|
|
- }
|
744
|
|
-
|
745
|
|
- benchmarkMerge(b, files)
|
746
|
|
-}
|
747
|
|
-
|
748
|
|
-// BenchmarkMergeJavaContentionLarge measures the overhead of merging two large
|
749
|
|
-// contention profiles of a Java program (caribou).
|
750
|
|
-func BenchmarkMergeJavaContentionLarge(b *testing.B) {
|
751
|
|
- files := []string{
|
752
|
|
- "caribou.contentionz.large.1.pb.gz",
|
753
|
|
- "caribou.contentionz.large.2.pb.gz",
|
754
|
|
- }
|
755
|
|
-
|
756
|
|
- benchmarkMerge(b, files)
|
757
|
|
-}
|
758
|
|
-
|
759
|
|
-// BenchmarkMergeJavaCPUWorst measures the overhead of merging rollups worth 7 days
|
760
|
|
-// for the worst case scenario. These rollups are generated by merging samples
|
761
|
|
-// (10 seconds/min) from /profilez handler of caribou prod jobs. They are deduplicated
|
762
|
|
-// so that Samples, Locations, Mappings, and Functions are unique.
|
763
|
|
-func BenchmarkMergeJavaCPUWorst(b *testing.B) {
|
764
|
|
- files := []string{
|
765
|
|
- "caribou.profilez.1min.1.pb.gz",
|
766
|
|
- "caribou.profilez.1min.2.pb.gz",
|
767
|
|
- "caribou.profilez.1min.3.pb.gz",
|
768
|
|
- "caribou.profilez.1min.4.pb.gz",
|
769
|
|
- "caribou.profilez.1min.5.pb.gz",
|
770
|
|
- "caribou.profilez.1min.6.pb.gz",
|
771
|
|
- "caribou.profilez.1min.7.pb.gz",
|
772
|
|
- "caribou.profilez.1min.8.pb.gz",
|
773
|
|
- "caribou.profilez.1min.9.pb.gz",
|
774
|
|
- "caribou.profilez.1min.10.pb.gz",
|
775
|
|
- "caribou.profilez.1min.11.pb.gz",
|
776
|
|
- "caribou.profilez.1min.12.pb.gz",
|
777
|
|
- "caribou.profilez.1min.13.pb.gz",
|
778
|
|
- "caribou.profilez.1min.14.pb.gz",
|
779
|
|
- "caribou.profilez.1min.15.pb.gz",
|
780
|
|
- "caribou.profilez.1min.16.pb.gz",
|
781
|
|
- "caribou.profilez.1min.17.pb.gz",
|
782
|
|
- "caribou.profilez.1min.18.pb.gz",
|
783
|
|
- "caribou.profilez.10mins.1.pb.gz",
|
784
|
|
- "caribou.profilez.10mins.2.pb.gz",
|
785
|
|
- "caribou.profilez.10mins.3.pb.gz",
|
786
|
|
- "caribou.profilez.10mins.4.pb.gz",
|
787
|
|
- "caribou.profilez.10mins.5.pb.gz",
|
788
|
|
- "caribou.profilez.10mins.6.pb.gz",
|
789
|
|
- "caribou.profilez.10mins.7.pb.gz",
|
790
|
|
- "caribou.profilez.10mins.8.pb.gz",
|
791
|
|
- "caribou.profilez.10mins.9.pb.gz",
|
792
|
|
- "caribou.profilez.10mins.10.pb.gz",
|
793
|
|
- "caribou.profilez.1hour.1.pb.gz",
|
794
|
|
- "caribou.profilez.1hour.2.pb.gz",
|
795
|
|
- "caribou.profilez.1hour.3.pb.gz",
|
796
|
|
- "caribou.profilez.1hour.4.pb.gz",
|
797
|
|
- "caribou.profilez.1hour.5.pb.gz",
|
798
|
|
- "caribou.profilez.1hour.6.pb.gz",
|
799
|
|
- "caribou.profilez.4hours.1.pb.gz",
|
800
|
|
- "caribou.profilez.4hours.2.pb.gz",
|
801
|
|
- "caribou.profilez.4hours.3.pb.gz",
|
802
|
|
- "caribou.profilez.4hours.4.pb.gz",
|
803
|
|
- "caribou.profilez.12hours.1.pb.gz",
|
804
|
|
- "caribou.profilez.12hours.2.pb.gz",
|
805
|
|
- "caribou.profilez.1day.1.pb.gz",
|
806
|
|
- "caribou.profilez.1day.2.pb.gz",
|
807
|
|
- "caribou.profilez.1day.3.pb.gz",
|
808
|
|
- "caribou.profilez.1day.4.pb.gz",
|
809
|
|
- "caribou.profilez.1day.5.pb.gz",
|
810
|
|
- }
|
811
|
|
-
|
812
|
|
- benchmarkMerge(b, files)
|
813
|
|
-}
|