Skip to content

Commit

Permalink
storage: update output for allocator_test's Example_rebalancing
Browse files Browse the repository at this point in the history
  • Loading branch information
BramGruneir committed Oct 27, 2016
1 parent 1ef40f3 commit 1f4cac2
Showing 1 changed file with 61 additions and 66 deletions.
127 changes: 61 additions & 66 deletions pkg/storage/allocator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1402,26 +1402,21 @@ func Example_rebalancing() {
}
}

// Output store capacities as hexadecimal 2-character values.
if i%(generations/50) == 0 {
var maxBytes int64
if i%(generations/printGenerations) == 0 {
var totalBytes int64
for j := 0; j < len(testStores); j++ {
bytes := testStores[j].Capacity.Capacity - testStores[j].Capacity.Available
if bytes > maxBytes {
maxBytes = bytes
}
totalBytes += testStores[j].Capacity.Capacity - testStores[j].Capacity.Available
}
if maxBytes > 0 {
for j := 0; j < len(testStores); j++ {
endStr := " "
if j == len(testStores)-1 {
endStr = ""
}
bytes := testStores[j].Capacity.Capacity - testStores[j].Capacity.Available
fmt.Printf("%03d%s", (999*bytes)/maxBytes, endStr)
fmt.Printf("generation %4d: ", i)
for j := 0; j < len(testStores); j++ {
if j != 0 && j != len(testStores)-1 {
fmt.Printf(",")
}
fmt.Printf("\n")
ts := testStores[j]
bytes := ts.Capacity.Capacity - ts.Capacity.Available
fmt.Printf("%3d %2d%%", ts.Capacity.RangeCount, (100*bytes)/totalBytes)
}
fmt.Printf("\n")
}
}

Expand All @@ -1434,55 +1429,55 @@ func Example_rebalancing() {
fmt.Printf("Total bytes=%d, ranges=%d\n", totBytes, totRanges)

// Output:
// 999 129 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
// 999 758 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 657 625
// 432 999 000 000 000 000 000 000 000 000 000 000 000 000 257 036 428 845 930 420
// 193 185 000 000 000 000 559 109 000 000 000 000 153 999 051 134 248 388 349 218
// 268 301 000 000 000 000 543 163 484 357 415 000 282 999 193 168 362 573 352 324
// 320 399 000 000 412 598 564 348 440 443 729 000 465 999 311 385 444 771 454 463
// 284 241 377 999 231 431 338 266 186 275 508 095 316 519 283 204 283 555 330 384
// 419 435 599 999 289 477 482 418 328 212 622 516 383 536 426 356 463 700 391 588
// 636 554 727 999 370 655 596 586 489 335 717 601 512 734 572 528 610 797 499 767
// 626 648 883 999 451 716 655 596 604 387 853 723 612 753 703 590 728 894 625 850
// 660 697 898 999 468 850 797 660 620 470 918 704 684 714 793 674 844 929 690 806
// 694 736 965 989 499 909 805 692 729 593 961 702 723 720 913 721 909 999 854 876
// 682 724 918 951 464 837 770 652 712 611 905 723 739 665 826 618 835 999 864 796
// 737 739 924 949 573 840 789 680 706 659 929 819 764 721 843 589 868 999 891 870
// 777 795 952 998 637 852 837 739 733 737 947 843 832 796 912 664 897 999 906 839
// 760 809 929 961 658 859 780 776 720 738 900 826 797 833 911 703 883 999 930 834
// 737 850 942 999 677 907 767 819 738 754 958 832 845 808 906 722 931 986 978 817
// 762 846 935 999 688 913 773 821 733 815 954 870 866 792 968 764 992 986 974 874
// 771 828 933 965 681 878 804 814 735 869 936 855 856 752 951 763 999 995 969 877
// 723 817 862 931 673 824 752 824 707 832 857 793 834 731 887 731 999 934 926 871
// 706 825 840 925 682 824 747 780 715 818 853 795 827 700 842 703 999 882 877 875
// 739 835 876 958 731 887 763 823 740 839 881 849 873 737 889 763 999 926 925 929
// 773 882 904 971 768 926 841 847 822 843 940 887 941 765 898 814 999 960 998 993
// 764 872 905 999 773 915 859 843 848 865 909 871 944 739 922 780 974 977 992 993
// 732 876 911 999 765 888 891 856 848 831 901 876 948 753 889 773 989 967 989 997
// 733 856 936 981 797 901 924 868 876 820 930 889 958 770 867 785 984 963 989 999
// 737 836 960 991 787 895 912 875 856 822 930 907 974 778 849 792 965 950 999 988
// 742 839 970 999 803 925 918 894 884 812 952 901 977 809 872 764 985 961 979 974
// 754 841 969 987 822 934 938 922 904 830 960 911 990 804 879 781 975 938 999 986
// 735 842 966 980 805 909 920 938 888 842 967 913 999 782 882 783 994 932 985 980
// 759 857 971 999 826 927 912 951 872 864 976 920 976 781 899 771 998 947 963 959
// 756 849 965 999 818 924 895 916 856 861 962 898 944 771 906 743 966 942 945 938
// 743 850 963 999 812 919 870 922 876 844 977 885 934 773 909 725 958 940 929 943
// 757 831 951 999 798 918 854 933 865 832 979 852 907 793 920 728 956 931 906 934
// 775 823 927 999 792 907 840 925 871 826 954 837 909 807 909 711 958 909 920 930
// 772 843 933 999 788 902 841 920 890 843 941 830 895 804 908 735 951 927 921 929
// 799 851 938 999 805 914 868 920 903 836 937 832 911 811 914 764 949 927 903 930
// 828 877 952 999 817 945 869 915 907 849 974 856 936 827 925 790 966 944 929 937
// 843 888 971 999 844 955 892 913 925 856 990 871 968 854 937 795 977 950 937 966
// 859 911 980 994 863 960 899 925 940 863 999 884 989 855 948 809 989 949 945 966
// 847 905 980 974 848 955 888 924 940 849 999 877 981 855 938 786 997 940 947 965
// 844 895 973 966 853 935 876 917 935 851 991 861 978 833 946 788 999 935 942 964
// 849 886 975 966 865 930 890 916 927 855 988 870 994 841 943 787 999 935 963 963
// 843 887 973 951 860 933 874 910 909 865 966 875 984 830 933 779 999 922 967 960
// 836 879 983 945 863 923 890 913 893 867 964 894 982 836 914 783 999 940 969 967
// 830 879 981 943 853 926 886 900 894 863 947 896 976 832 903 771 999 935 972 967
// 830 879 981 943 853 926 886 900 894 863 947 896 976 832 903 771 999 935 972 967
// 830 879 981 943 853 926 886 900 894 863 947 896 976 832 903 771 999 935 972 967
// 830 879 981 943 853 926 886 900 894 863 947 896 976 832 903 771 999 935 972 967
// 830 879 981 943 853 926 886 900 894 863 947 896 976 832 903 771 999 935 972 967
// generation 0: 1 88%, 1 11%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0% 0 0%
// generation 2: 1 32%, 2 24%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 2 21% 2 20%
// generation 4: 2 9%, 2 22%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 0 0%, 3 5%, 1 0%, 2 9%, 2 19%, 2 21% 3 9%
// generation 6: 3 5%, 2 5%, 0 0%, 0 0%, 0 0%, 0 0%, 6 15%, 1 3%, 0 0%, 0 0%, 0 0%, 0 0%, 2 4%, 7 27%, 3 1%, 2 3%, 2 6%, 2 10%, 2 9% 3 6%
// generation 8: 3 4%, 3 5%, 0 0%, 0 0%, 0 0%, 0 0%, 6 9%, 3 2%, 7 8%, 7 6%, 3 7%, 0 0%, 3 4%, 7 17%, 4 3%, 3 2%, 3 6%, 3 9%, 3 6% 3 5%
// generation 10: 5 3%, 5 4%, 0 0%, 0 0%, 5 4%, 5 6%, 6 6%, 5 4%, 7 5%, 7 5%, 5 8%, 0 0%, 5 5%, 7 11%, 5 3%, 5 4%, 5 5%, 5 9%, 5 5% 5 5%
// generation 12: 6 3%, 6 3%, 5 5%, 15 14%, 6 3%, 6 6%, 6 4%, 6 3%, 7 2%, 7 3%, 6 7%, 3 1%, 6 4%, 7 7%, 6 3%, 6 2%, 6 3%, 6 7%, 6 4% 6 5%
// generation 14: 8 4%, 8 4%, 8 6%, 15 10%, 8 2%, 8 4%, 8 5%, 8 4%, 8 3%, 8 2%, 8 6%, 9 5%, 8 3%, 8 5%, 8 4%, 8 3%, 8 4%, 8 7%, 8 4% 8 6%
// generation 16: 11 5%, 10 4%, 10 5%, 15 8%, 10 3%, 10 5%, 10 4%, 10 4%, 10 3%, 10 2%, 10 5%, 11 4%, 10 4%, 10 5%, 10 4%, 10 4%, 10 4%, 10 6%, 10 4% 11 6%
// generation 18: 13 4%, 12 4%, 12 6%, 15 7%, 12 3%, 12 5%, 12 4%, 12 4%, 12 4%, 12 2%, 12 6%, 13 5%, 12 4%, 12 5%, 12 5%, 12 4%, 13 5%, 13 6%, 12 4% 13 6%
// generation 20: 15 4%, 14 4%, 14 6%, 16 6%, 14 3%, 14 5%, 14 5%, 14 4%, 14 4%, 14 3%, 14 6%, 15 4%, 14 4%, 14 4%, 14 5%, 15 4%, 15 5%, 15 6%, 14 4% 15 5%
// generation 22: 17 4%, 16 4%, 16 6%, 18 6%, 16 3%, 16 5%, 16 5%, 16 4%, 16 4%, 16 3%, 16 6%, 17 4%, 16 4%, 16 4%, 16 5%, 17 4%, 17 5%, 17 6%, 16 5% 17 5%
// generation 24: 19 4%, 18 4%, 18 6%, 20 6%, 18 3%, 18 5%, 18 5%, 18 4%, 18 4%, 18 3%, 18 5%, 19 4%, 18 4%, 18 4%, 18 5%, 19 4%, 19 5%, 19 6%, 18 5% 19 5%
// generation 26: 21 4%, 20 4%, 20 5%, 22 5%, 20 3%, 20 5%, 20 4%, 20 4%, 20 4%, 20 4%, 20 5%, 21 5%, 20 4%, 20 4%, 20 5%, 21 3%, 21 5%, 21 6%, 20 5% 21 5%
// generation 28: 23 4%, 22 4%, 22 5%, 24 5%, 22 3%, 22 5%, 22 5%, 22 4%, 22 4%, 22 4%, 22 5%, 23 5%, 22 4%, 22 4%, 22 5%, 23 3%, 23 5%, 23 5%, 22 5% 23 5%
// generation 30: 25 4%, 24 4%, 24 5%, 26 5%, 24 3%, 24 5%, 24 4%, 24 4%, 24 4%, 24 4%, 24 5%, 25 4%, 24 4%, 24 5%, 24 5%, 25 4%, 25 5%, 25 6%, 24 5% 25 5%
// generation 32: 27 4%, 26 5%, 26 5%, 28 5%, 26 3%, 26 5%, 26 4%, 26 4%, 26 4%, 26 4%, 26 5%, 27 4%, 26 4%, 26 4%, 26 5%, 27 4%, 27 5%, 27 5%, 26 5% 27 4%
// generation 34: 29 4%, 28 4%, 28 5%, 30 5%, 28 3%, 28 5%, 28 4%, 28 4%, 28 4%, 28 4%, 28 5%, 29 5%, 28 4%, 28 4%, 28 5%, 29 4%, 29 5%, 29 5%, 28 5% 29 5%
// generation 36: 31 4%, 30 4%, 30 5%, 32 5%, 30 3%, 30 5%, 30 4%, 30 4%, 30 4%, 30 5%, 30 5%, 31 4%, 30 4%, 30 4%, 30 5%, 31 4%, 31 5%, 31 5%, 30 5% 31 5%
// generation 38: 33 4%, 32 4%, 32 5%, 34 5%, 32 4%, 32 4%, 32 4%, 32 4%, 32 4%, 32 5%, 32 5%, 33 4%, 32 5%, 32 4%, 32 5%, 33 4%, 33 6%, 33 5%, 32 5% 33 5%
// generation 40: 35 4%, 34 5%, 34 5%, 36 5%, 34 4%, 34 5%, 34 4%, 34 4%, 34 4%, 34 5%, 34 5%, 35 4%, 34 5%, 34 4%, 34 5%, 35 4%, 35 6%, 35 5%, 34 5% 35 5%
// generation 42: 37 4%, 36 4%, 36 5%, 38 5%, 36 4%, 36 5%, 36 4%, 36 4%, 36 4%, 36 4%, 36 5%, 37 5%, 36 5%, 36 4%, 36 5%, 37 4%, 37 5%, 37 5%, 36 5% 37 5%
// generation 44: 39 4%, 38 4%, 38 5%, 40 5%, 38 4%, 38 5%, 38 4%, 38 4%, 38 4%, 38 4%, 38 5%, 39 4%, 38 5%, 38 4%, 38 5%, 39 4%, 39 5%, 39 5%, 38 5% 39 5%
// generation 46: 41 4%, 40 4%, 40 5%, 42 5%, 40 4%, 40 5%, 40 4%, 40 4%, 40 4%, 40 4%, 40 5%, 41 4%, 40 5%, 40 4%, 40 5%, 41 4%, 41 5%, 41 5%, 40 5% 41 5%
// generation 48: 43 4%, 42 4%, 42 5%, 44 5%, 42 4%, 42 5%, 42 5%, 42 4%, 42 4%, 42 4%, 42 5%, 43 4%, 42 5%, 42 4%, 42 5%, 43 4%, 43 5%, 43 5%, 42 5% 43 5%
// generation 50: 45 4%, 44 4%, 44 5%, 46 5%, 44 4%, 44 5%, 44 5%, 44 4%, 44 4%, 44 4%, 44 5%, 45 4%, 44 5%, 44 4%, 44 4%, 45 4%, 45 5%, 45 5%, 44 5% 45 5%
// generation 52: 47 4%, 46 4%, 46 5%, 48 5%, 46 4%, 46 5%, 46 5%, 46 4%, 46 4%, 46 4%, 46 5%, 47 5%, 46 5%, 46 4%, 46 4%, 47 4%, 47 5%, 47 5%, 46 5% 47 5%
// generation 54: 49 4%, 48 4%, 48 5%, 50 5%, 48 4%, 48 5%, 48 5%, 48 4%, 48 4%, 48 4%, 48 5%, 49 5%, 48 5%, 48 4%, 48 4%, 49 4%, 49 5%, 49 5%, 48 5% 49 5%
// generation 56: 51 4%, 50 4%, 50 5%, 52 5%, 50 4%, 50 5%, 50 5%, 50 5%, 50 4%, 50 4%, 50 5%, 51 5%, 50 5%, 50 4%, 50 4%, 51 4%, 51 5%, 51 5%, 50 5% 51 5%
// generation 58: 53 4%, 52 4%, 52 5%, 54 5%, 52 4%, 52 5%, 52 5%, 52 5%, 52 4%, 52 4%, 52 5%, 53 5%, 52 5%, 52 4%, 52 4%, 53 4%, 53 5%, 53 5%, 52 5% 53 5%
// generation 60: 55 4%, 54 4%, 54 5%, 56 5%, 54 4%, 54 5%, 54 5%, 54 5%, 54 4%, 54 4%, 54 5%, 55 5%, 54 5%, 54 4%, 54 4%, 55 4%, 55 5%, 55 5%, 54 5% 55 5%
// generation 62: 57 4%, 56 4%, 56 5%, 58 5%, 56 4%, 56 5%, 56 5%, 56 5%, 56 4%, 56 4%, 56 5%, 57 5%, 56 5%, 56 4%, 56 5%, 57 4%, 57 5%, 57 5%, 56 5% 57 5%
// generation 64: 59 4%, 58 4%, 58 5%, 60 5%, 58 4%, 58 5%, 58 4%, 58 5%, 58 4%, 58 4%, 58 5%, 59 4%, 58 5%, 58 4%, 58 5%, 59 4%, 59 5%, 59 5%, 58 5% 59 5%
// generation 66: 61 4%, 60 4%, 60 5%, 62 5%, 60 4%, 60 5%, 60 4%, 60 5%, 60 4%, 60 4%, 60 5%, 61 4%, 60 5%, 60 4%, 60 5%, 61 4%, 61 5%, 61 5%, 60 5% 61 5%
// generation 68: 63 4%, 62 4%, 62 5%, 64 5%, 62 4%, 62 5%, 62 4%, 62 5%, 62 4%, 62 4%, 62 5%, 63 4%, 62 5%, 62 4%, 62 5%, 63 4%, 63 5%, 63 5%, 62 5% 63 5%
// generation 70: 65 4%, 64 4%, 64 5%, 66 5%, 64 4%, 64 5%, 64 4%, 64 5%, 64 5%, 64 4%, 64 5%, 65 4%, 64 5%, 64 4%, 64 5%, 65 4%, 65 5%, 65 5%, 64 5% 65 5%
// generation 72: 67 4%, 66 4%, 66 5%, 68 5%, 66 4%, 66 5%, 66 4%, 66 5%, 66 5%, 66 4%, 66 5%, 67 4%, 66 5%, 66 4%, 66 5%, 67 4%, 67 5%, 67 5%, 66 5% 67 5%
// generation 74: 69 4%, 68 4%, 68 5%, 70 5%, 68 4%, 68 5%, 68 4%, 68 5%, 68 5%, 68 4%, 68 5%, 69 4%, 68 5%, 68 4%, 68 5%, 69 4%, 69 5%, 69 5%, 68 5% 69 5%
// generation 76: 71 4%, 70 4%, 70 5%, 72 5%, 70 4%, 70 5%, 70 4%, 70 4%, 70 5%, 70 4%, 70 5%, 71 4%, 70 5%, 70 4%, 70 5%, 71 4%, 71 5%, 71 5%, 70 5% 71 5%
// generation 78: 73 4%, 72 4%, 72 5%, 74 5%, 72 4%, 72 5%, 72 4%, 72 4%, 72 5%, 72 4%, 72 5%, 73 4%, 72 5%, 72 4%, 72 5%, 73 4%, 73 5%, 73 5%, 72 5% 73 5%
// generation 80: 75 4%, 74 4%, 74 5%, 76 5%, 74 4%, 74 5%, 74 4%, 74 5%, 74 5%, 74 4%, 74 5%, 75 4%, 74 5%, 74 4%, 74 5%, 75 4%, 75 5%, 75 5%, 74 5% 75 5%
// generation 82: 77 4%, 76 4%, 76 5%, 78 5%, 76 4%, 76 5%, 76 4%, 76 5%, 76 5%, 76 4%, 76 5%, 77 4%, 76 5%, 76 4%, 76 5%, 77 4%, 77 5%, 77 5%, 76 5% 77 5%
// generation 84: 79 4%, 78 4%, 78 5%, 80 5%, 78 4%, 78 5%, 78 4%, 78 4%, 78 5%, 78 4%, 78 5%, 79 4%, 78 5%, 78 4%, 78 5%, 79 4%, 79 5%, 79 5%, 78 5% 79 5%
// generation 86: 81 4%, 80 4%, 80 5%, 82 5%, 80 4%, 80 5%, 80 4%, 80 4%, 80 4%, 80 4%, 80 5%, 81 4%, 80 5%, 80 4%, 80 5%, 81 4%, 81 5%, 81 5%, 80 5% 81 5%
// generation 88: 83 4%, 82 4%, 82 5%, 84 5%, 82 4%, 82 5%, 82 4%, 82 5%, 82 4%, 82 4%, 82 5%, 83 4%, 82 5%, 82 4%, 82 5%, 83 4%, 83 5%, 83 5%, 82 5% 83 5%
// generation 90: 84 4%, 83 4%, 83 5%, 85 5%, 83 4%, 83 5%, 83 4%, 83 4%, 83 4%, 83 4%, 83 5%, 84 4%, 83 5%, 83 4%, 83 4%, 84 4%, 84 5%, 84 5%, 83 5% 84 5%
// generation 92: 84 4%, 83 4%, 83 5%, 85 5%, 83 4%, 83 5%, 83 4%, 83 4%, 83 4%, 83 4%, 83 5%, 84 4%, 83 5%, 83 4%, 83 4%, 84 4%, 84 5%, 84 5%, 83 5% 84 5%
// generation 94: 84 4%, 83 4%, 83 5%, 85 5%, 83 4%, 83 5%, 83 4%, 83 4%, 83 4%, 83 4%, 83 5%, 84 4%, 83 5%, 83 4%, 83 4%, 84 4%, 84 5%, 84 5%, 83 5% 84 5%
// generation 96: 84 4%, 83 4%, 83 5%, 85 5%, 83 4%, 83 5%, 83 4%, 83 4%, 83 4%, 83 4%, 83 5%, 84 4%, 83 5%, 83 4%, 83 4%, 84 4%, 84 5%, 84 5%, 83 5% 84 5%
// generation 98: 84 4%, 83 4%, 83 5%, 85 5%, 83 4%, 83 5%, 83 4%, 83 4%, 83 4%, 83 4%, 83 5%, 84 4%, 83 5%, 83 4%, 83 4%, 84 4%, 84 5%, 84 5%, 83 5% 84 5%
// Total bytes=872399094, ranges=1668
}

0 comments on commit 1f4cac2

Please sign in to comment.