Exemplo n.º 1
0
    def _write_stat_per_test(self, stat_file_name, time_result_dict):
        """Write stat of per-test results to csv file

        note: take the full dictionary of test and calculate overall stat

        """
        full_list = []  # list containing 1st to 5kth data point
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(len(time_result_dict)):
            time_list = time_result_dict.get('thread-{}'.format(i))
            full_list += time_list

        stat_dict = generate_stat_for_concurrent_thread(
            'test-{}'.format(len(time_result_dict)),
            full_list,
            stat_file_name,
            len(full_list), 1)

        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Stat - per test '
            '({0}-{1}-clients)'
            .format(test_category, current_num_threads),
            '{0}-per-test-{1}-clients.svg'
            .format(test_category, current_num_threads),
            'test'
        )
    def _write_stat_per_client_bucketized(
            self, stat_file_name,
            time_result_dict,
            current_num_threads,
            is_attach):
        """Write bucketized stat of per-client results to csv file

        note: each bucket is a split of a client i

        """
        for i in range(current_num_threads):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)
            stat_dict = generate_stat_for_concurrent_thread(
                thread_name,
                time_list,
                stat_file_name,
                self.bucket_size,
                self.num_buckets
            )

            generate_line_chart_bucketized_stat(
                stat_dict,
                'Concurrent Subscription Stat - per client bucketized '
                'client-{0} total-{1}-clients'.format(i, current_num_threads),
                'stat-client-{0}-bucketized-{1}-clients.svg'
                .format(i, current_num_threads),
                self.bucket_size,
                self.num_buckets
            )
Exemplo n.º 3
0
    def _write_stat_per_client_bucketized(self, stat_file_name,
                                          time_result_dict,
                                          current_num_threads):
        """Write bucketized stat of per-client results to csv file

        note: each bucket is a split of a client i

        """
        test_category = self._get_output_filename(stat_file_name)

        for i in range(current_num_threads):
            time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)
            stat_dict = generate_stat_for_concurrent_thread(
                thread_name,
                time_list,
                stat_file_name,
                self.bucket_size,
                self.num_buckets
            )

            # create line chart with each client being grouped by buckets
            generate_line_chart_bucketized_stat(
                stat_dict,
                'Concurrent Subscription Stat - per client bucketized -'
                'Client-{0} by {1}-{2}-clients'
                .format(i, test_category, current_num_threads),
                '{0}-client-{1}-bucketized-{2}-clients.svg'
                .format(test_category, i, current_num_threads),
                self.bucket_size,
                self.num_buckets
            )
Exemplo n.º 4
0
    def _write_stat_per_client(self, stat_file_name, time_result_dict,
                               current_num_threads, is_attach):
        """Write stat of per-client results to csv file

        note: take the full list of a client i; calculate stat on the list

        """
        stat_dict = {}
        return_stat = {}
        num_clients = len(time_result_dict)
        for i in range(current_num_threads):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)

            # for each client i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                thread_name, time_list, stat_file_name, len(time_list), 1)

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create graph based on stats of all clients
        generate_bar_chart_stat(
            stat_dict, 'Concurrent Subscription Stat - per client '
            '({} clients)'.format(num_clients),
            'stat-per-client-{}-clients.svg'.format(num_clients), 'client')
def write_stat_per_test_bucketized(
    time_result_dict, is_attach=True):
    stat_dict = {}
    return_stat = {}
    num_clients = len(time_result_dict)
    for i in range(10):
        chunks_bucket_i = []
        for j in range(len(time_result_dict)):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(j))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(j))
            # slice out bucket-size from each client's result and merge
            chunks_bucket_i += time_list[
                i * 125: (i + 1) * 125
            ]
        # for each chunk i, compute and output its stat
        return_stat = generate_stat_for_concurrent_thread(
            'bucket-{}'.format(i),
            chunks_bucket_i,
            'csv-test-per-client.csv',
            len(chunks_bucket_i), 1)
        # for each chunk i, add stat into final return_dict
        stat_dict.update({
            i: return_stat.get(0, (0, 0, 0, 0))
        })
    # create graph based on stats of all chunks
    generate_line_chart_bucketized_stat(
        stat_dict,
        'Concurrent Subscription Stat - per test bucketized '
        '({} clients)'.format(num_clients),
        'stat-test-bucketized-{}-clients.svg'.format(num_clients),
        500,
        10
    )
Exemplo n.º 6
0
    def _write_stat_per_test(self, stat_file_name, time_result_dict):
        """Write stat of per-test results to csv file

        note: take the full dictionary of test and calculate overall stat

        """
        full_list = []  # list containing 1st to 5kth data point
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(len(time_result_dict)):
            time_list = time_result_dict.get('thread-{}'.format(i))
            full_list += time_list

        stat_dict = generate_stat_for_concurrent_thread(
            'test-{}'.format(len(time_result_dict)),
            full_list,
            stat_file_name,
            len(full_list),
            1
        )

        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Statistics - per test: '
            '({0}-{1}-clients)'
            .format(test_category, current_num_threads),
            '{0}-per-test-{1}-clients.svg'
            .format(test_category, current_num_threads),
            'test'
        )
Exemplo n.º 7
0
    def _write_stat_per_test_bucketized(
            self,
            stat_file_name,
            time_result_dict):
        """Write bucketized stat of per-test to csv file

        note: each bucket of all clients would merge into a chunk;
        generate stat for each such chunk. For example::

            Input: # of clients = 10
            thread-0: [(50 data) | (50 data)|...]
            thread-1: [(50 data) | (50 data)|...]
            ...
            thread-9: [(50 data) | (50 data)|...]
            Output:
            sublist [500 data grouped from all clients' first buckets],
                    [500 data grouped from all clients' next buckets],
                    ...
                    [500 data grouped from all clients' last buckets];
            line chart of statistics on these chunks.

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(self.num_buckets):
            chunks_bucket_i = []
            for j in range(len(time_result_dict)):
                time_list = time_result_dict.get('thread-{0}'.format(j))
                # slice out bucket-size from each client's result and merge
                chunks_bucket_i += time_list[
                    i * self.bucket_size: (i + 1) * self.bucket_size
                ]

            # for each chunk i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                'bucket-{0}'.format(i),
                chunks_bucket_i,
                stat_file_name,
                len(chunks_bucket_i),
                1
            )

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create line chart with all clients grouped by a chunk of buckets
        generate_line_chart_stat_bucketized_candlepin(
            stat_dict,
            'Concurrent Subscription Statistics - per test bucketized: '
            '({0}-{1}-clients)'
            .format(test_category, current_num_threads),
            '{0}-test-bucketized-{1}-clients.svg'
            .format(test_category, current_num_threads),
            self.bucket_size,
            self.num_buckets
        )
Exemplo n.º 8
0
    def _write_stat_per_test(self, stat_file_name, time_result_dict,
                             is_attach):
        """Write stat of per-test results to csv file

        note: take the full dictionary of test and calculate overall stat

        """
        full_list = []  # list containing 1st to 5kth data point
        num_clients = len(time_result_dict)

        for i in range(len(time_result_dict)):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            full_list += time_list

        stat_dict = generate_stat_for_concurrent_thread(
            'test-{}'.format(len(time_result_dict)), full_list, stat_file_name,
            len(full_list), 1)

        generate_bar_chart_stat(
            stat_dict, 'Concurrent Subscription Stat - per test '
            '({} clients)'.format(num_clients),
            'stat-per-test-{}-clients.svg'.format(num_clients), 'test')
Exemplo n.º 9
0
    def _write_stat_per_client_bucketized(self, stat_file_name,
                                          time_result_dict,
                                          current_num_threads, is_attach):
        """Write bucketized stat of per-client results to csv file

        note: each bucket is a split of a client i

        """
        for i in range(current_num_threads):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)
            stat_dict = generate_stat_for_concurrent_thread(
                thread_name, time_list, stat_file_name, self.bucket_size,
                self.num_buckets)

            generate_line_chart_bucketized_stat(
                stat_dict,
                'Concurrent Subscription Stat - per client bucketized '
                'client-{0} total-{1}-clients'.format(i, current_num_threads),
                'stat-client-{0}-bucketized-{1}-clients.svg'.format(
                    i,
                    current_num_threads), self.bucket_size, self.num_buckets)
Exemplo n.º 10
0
    def _write_stat_per_client_bucketized(self, stat_file_name,
                                          time_result_dict,
                                          current_num_threads):
        """Write bucketized stat of per-client results to csv file

        note: each bucket is just a split of a client i. For example::

            Input: # of clients = 1
            {thread-i: [(50 data) | (50 data)|...]}
            Output:
            line chart of statistics on these buckets.

        """
        test_category = self._get_output_filename(stat_file_name)

        for i in range(current_num_threads):
            time_list = time_result_dict.get('thread-{0}'.format(i))
            thread_name = 'client-{0}'.format(i)
            stat_dict = generate_stat_for_concurrent_thread(
                thread_name, time_list, stat_file_name, self.bucket_size,
                self.num_buckets)

            # create line chart with each client being grouped by buckets
            generate_line_chart_stat_bucketized_candlepin(
                stat_dict,
                'Concurrent Subscription Statistics - per client bucketized: '
                'Client-{0} by {1}-{2}-clients'.format(i, test_category,
                                                       current_num_threads),
                '{0}-client-{1}-bucketized-{2}-clients.svg'.format(
                    test_category, i,
                    current_num_threads), self.bucket_size, self.num_buckets)
def write_stat_per_client(time_result_dict,
                          current_num_threads, is_attach=True):
    stat_dict = {}
    return_stat = {}
    num_clients = len(time_result_dict)
    for i in range(current_num_threads):
        if is_attach:
            time_list = time_result_dict.get('thread-{}'.format(i))[2]
        else:
            time_list = time_result_dict.get('thread-{}'.format(i))
        thread_name = 'client-{}'.format(i)
        # for each client i, compute and output its stat
        return_stat = generate_stat_for_concurrent_thread(
            thread_name,
            time_list,
            'csv-test-per-client.csv',
            len(time_list), 1)
        # for each chunk i, add stat into final return_dict
        stat_dict.update({
            i: return_stat.get(0, (0, 0, 0, 0))
        })
    # create graph based on stats of all clients
    generate_bar_chart_stat(
        stat_dict,
        'Concurrent Subscription Stat - per client '
        '({} clients)'.format(num_clients),
        'stat-per-client-{}-clients.svg'.format(num_clients),
        'client'
    )
Exemplo n.º 12
0
    def _write_stat_per_client(self, stat_file_name, time_result_dict,
                               current_num_threads):
        """Write stat of per-client results to csv file

        note: take the full list of a client i; calculate stat on the list

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(current_num_threads):
            time_list = time_result_dict.get('thread-{0}'.format(i))
            thread_name = 'client-{0}'.format(i)

            # for each client i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                thread_name, time_list, stat_file_name, len(time_list), 1)

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create graph based on stats of all clients
        generate_bar_chart_stat(
            stat_dict, 'Concurrent Subscription Statistics - per client: '
            '({0}-{1}-clients)'.format(test_category, current_num_threads),
            '{0}-per-client-{1}-clients.svg'.format(test_category,
                                                    current_num_threads),
            'client')
    def _write_stat_per_test(self, stat_file_name,
                             time_result_dict, is_attach):
        """Write stat of per-test results to csv file

        note: take the full dictionary of test and calculate overall stat

        """
        full_list = []  # list containing 1st to 5kth data point
        num_clients = len(time_result_dict)

        for i in range(len(time_result_dict)):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            full_list += time_list

        stat_dict = generate_stat_for_concurrent_thread(
            'test-{}'.format(len(time_result_dict)),
            full_list,
            stat_file_name,
            len(full_list), 1)

        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Stat - per test '
            '({} clients)'.format(num_clients),
            'stat-per-test-{}-clients.svg'.format(num_clients),
            'test'
        )
Exemplo n.º 14
0
    def _write_stat_per_test_bucketized(
            self,
            stat_file_name,
            time_result_dict):
        """Write bucketized stat of per-test to csv file

        note: each bucket of all clients would merge into a chunk;
        generate stat for each such chunk. For example::

            Input: # of clients = 10
            thread-0: [(50 data) | (50 data)|...]
            thread-1: [(50 data) | (50 data)|...]
            ...
            thread-9: [(50 data) | (50 data)|...]
            Output:
            sublist [500 data grouped from all clients' first buckets],
                    [500 data grouped from all clients' next buckets],
                    ...
                    [500 data grouped from all clients' last buckets];
            line chart of statistics on these chunks.

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(self.num_buckets):
            chunks_bucket_i = []
            for j in range(len(time_result_dict)):
                time_list = time_result_dict.get('thread-{}'.format(j))
                # slice out bucket-size from each client's result and merge
                chunks_bucket_i += time_list[
                    i * self.bucket_size: (i + 1) * self.bucket_size
                ]

            # for each chunk i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                'bucket-{}'.format(i),
                chunks_bucket_i,
                stat_file_name,
                len(chunks_bucket_i),
                1
            )

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create line chart with all clients grouped by a chunk of buckets
        generate_line_chart_stat_bucketized_candlepin(
            stat_dict,
            'Concurrent Subscription Statistics - per test bucketized: '
            '({0}-{1}-clients)'
            .format(test_category, current_num_threads),
            '{0}-test-bucketized-{1}-clients.svg'
            .format(test_category, current_num_threads),
            self.bucket_size,
            self.num_buckets
        )
def write_stat_per_client_bucketized( 
    time_result_dict,
    current_num_threads,
    is_attach=True):
    for i in range(current_num_threads):
        if is_attach:
            time_list = time_result_dict.get('thread-{}'.format(i))[2]
        else:
            time_list = time_result_dict.get('thread-{}'.format(i))
        thread_name = 'client-{}'.format(i)
        stat_dict, buckets = generate_stat_for_concurrent_thread(
            thread_name,
            time_list,
            'csv-test-per-client.csv',
            125,
            4
        )
        generate_line_chart_bucketized_stat(
            stat_dict,
            'Concurrent Subscription Stat - per client bucketized '
            'client-{0} total-{1}-clients'.format(i, current_num_threads),
            'stat-client-{}-bucketized.svg'.format(i),
            125,
            10
        )
    def _write_stat_per_test_bucketized(
            self, stat_file_name,
            time_result_dict,
            is_attach):
        """Write bucketized stat of per-test to csv file

        note: each bucket of all clients would merge into a chunk;
        generate stat for each such chunk. For example::

            Input: # of clients = 10
            thread-0: [(50 data) | (50 data)|...]
            thread-1: [(50 data) | (50 data)|...]
            ...
            thread-9: [(50 data) | (50 data)|...]
            Output:
            sublist [500 data in all first buckets of each thread]
                    [500]...[500]

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        num_clients = len(time_result_dict)

        for i in range(self.num_buckets):
            chunks_bucket_i = []
            for j in range(len(time_result_dict)):
                if is_attach:
                    time_list = time_result_dict.get('thread-{}'.format(j))[2]
                else:
                    time_list = time_result_dict.get('thread-{}'.format(j))
                # slice out bucket-size from each client's result and merge
                chunks_bucket_i += time_list[
                    i * self.bucket_size: (i + 1) * self.bucket_size
                ]

            # for each chunk i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                'bucket-{}'.format(i),
                chunks_bucket_i,
                stat_file_name,
                len(chunks_bucket_i), 1)

            # for each chunk i, add stat into final return_dict
            stat_dict.update({
                i: return_stat.get(0, (0, 0, 0, 0))
            })

        # create graph based on stats of all chunks
        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Stat - per test bucketized '
            '({} clients)'.format(num_clients),
            'stat-test-bucketized-{}-clients.svg'.format(num_clients),
            self.bucket_size,
            self.num_buckets
        )
def write_stat_per_client_bucketized(time_result_dict,
                                     current_num_threads,
                                     is_attach=True):
    for i in range(current_num_threads):
        if is_attach:
            time_list = time_result_dict.get('thread-{}'.format(i))[2]
        else:
            time_list = time_result_dict.get('thread-{}'.format(i))
        thread_name = 'client-{}'.format(i)
        stat_dict, buckets = generate_stat_for_concurrent_thread(
            thread_name, time_list, 'csv-test-per-client.csv', 125, 4)
        generate_line_chart_bucketized_stat(
            stat_dict, 'Concurrent Subscription Stat - per client bucketized '
            'client-{0} total-{1}-clients'.format(i, current_num_threads),
            'stat-client-{}-bucketized.svg'.format(i), 125, 10)
def write_stat_per_test(time_result_dict, is_attach=True):
    full_list = []  # list containing 1st to 5kth data point
    num_clients = len(time_result_dict)
    for i in range(len(time_result_dict)):
        if is_attach:
            time_list = time_result_dict.get('thread-{}'.format(i))[2]
        else:
            time_list = time_result_dict.get('thread-{}'.format(i))
        full_list += time_list
    stat_dict = generate_stat_for_concurrent_thread(
        'test-{}'.format(len(time_result_dict)), full_list,
        'csv-test-per-client.csv', len(full_list), 1)
    generate_bar_chart_stat(
        stat_dict, 'Concurrent Subscription Stat - per test '
        '({} clients)'.format(num_clients),
        'stat-per-test-{}-clients.svg'.format(num_clients), 'test')
Exemplo n.º 19
0
    def _write_stat_per_test_bucketized(self, stat_file_name, time_result_dict,
                                        is_attach):
        """Write bucketized stat of per-test to csv file

        note: each bucket of all clients would merge into a chunk;
        generate stat for each such chunk. For example::

            Input: # of clients = 10
            thread-0: [(50 data) | (50 data)|...]
            thread-1: [(50 data) | (50 data)|...]
            ...
            thread-9: [(50 data) | (50 data)|...]
            Output:
            sublist [500 data in all first buckets of each thread]
                    [500]...[500]

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        num_clients = len(time_result_dict)

        for i in range(self.num_buckets):
            chunks_bucket_i = []
            for j in range(len(time_result_dict)):
                if is_attach:
                    time_list = time_result_dict.get('thread-{}'.format(j))[2]
                else:
                    time_list = time_result_dict.get('thread-{}'.format(j))
                # slice out bucket-size from each client's result and merge
                chunks_bucket_i += time_list[i * self.bucket_size:(i + 1) *
                                             self.bucket_size]

            # for each chunk i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                'bucket-{}'.format(i), chunks_bucket_i, stat_file_name,
                len(chunks_bucket_i), 1)

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create graph based on stats of all chunks
        generate_bar_chart_stat(
            stat_dict, 'Concurrent Subscription Stat - per test bucketized '
            '({} clients)'.format(num_clients),
            'stat-test-bucketized-{}-clients.svg'.format(num_clients),
            self.bucket_size, self.num_buckets)
Exemplo n.º 20
0
    def _write_stat_per_client(
            self,
            stat_file_name,
            time_result_dict,
            current_num_threads):
        """Write stat of per-client results to csv file

        note: take the full list of a client i; calculate stat on the list

        """
        # parameters for generating bucketized line chart
        stat_dict = {}
        return_stat = {}
        current_num_threads = len(time_result_dict)
        test_category = self._get_output_filename(stat_file_name)

        for i in range(current_num_threads):
            time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)

            # for each client i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                thread_name,
                time_list,
                stat_file_name,
                len(time_list),
                1
            )

            # for each chunk i, add stat into final return_dict
            stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})

        # create graph based on stats of all clients
        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Statistics - per client: '
            '({0}-{1}-clients)'
            .format(test_category, current_num_threads),
            '{0}-per-client-{1}-clients.svg'
            .format(test_category, current_num_threads),
            'client'
        )
Exemplo n.º 21
0
    def _write_stat_per_client_bucketized(
            self,
            stat_file_name,
            time_result_dict,
            current_num_threads):
        """Write bucketized stat of per-client results to csv file

        note: each bucket is just a split of a client i. For example::

            Input: # of clients = 1
            {thread-i: [(50 data) | (50 data)|...]}
            Output:
            line chart of statistics on these buckets.

        """
        test_category = self._get_output_filename(stat_file_name)

        for i in range(current_num_threads):
            time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)
            stat_dict = generate_stat_for_concurrent_thread(
                thread_name,
                time_list,
                stat_file_name,
                self.bucket_size,
                self.num_buckets
            )

            # create line chart with each client being grouped by buckets
            generate_line_chart_stat_bucketized_candlepin(
                stat_dict,
                'Concurrent Subscription Statistics - per client bucketized: '
                'Client-{0} by {1}-{2}-clients'
                .format(i, test_category, current_num_threads),
                '{0}-client-{1}-bucketized-{2}-clients.svg'
                .format(test_category, i, current_num_threads),
                self.bucket_size,
                self.num_buckets
            )
def write_stat_per_client(time_result_dict,
                          current_num_threads,
                          is_attach=True):
    stat_dict = {}
    return_stat = {}
    num_clients = len(time_result_dict)
    for i in range(current_num_threads):
        if is_attach:
            time_list = time_result_dict.get('thread-{}'.format(i))[2]
        else:
            time_list = time_result_dict.get('thread-{}'.format(i))
        thread_name = 'client-{}'.format(i)
        # for each client i, compute and output its stat
        return_stat = generate_stat_for_concurrent_thread(
            thread_name, time_list, 'csv-test-per-client.csv', len(time_list),
            1)
        # for each chunk i, add stat into final return_dict
        stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})
    # create graph based on stats of all clients
    generate_bar_chart_stat(
        stat_dict, 'Concurrent Subscription Stat - per client '
        '({} clients)'.format(num_clients),
        'stat-per-client-{}-clients.svg'.format(num_clients), 'client')
    def _write_stat_per_client(self, stat_file_name, time_result_dict,
                               current_num_threads, is_attach):
        """Write stat of per-client results to csv file

        note: take the full list of a client i; calculate stat on the list

        """
        stat_dict = {}
        return_stat = {}
        num_clients = len(time_result_dict)
        for i in range(current_num_threads):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(i))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(i))
            thread_name = 'client-{}'.format(i)

            # for each client i, compute and output its stat
            return_stat = generate_stat_for_concurrent_thread(
                thread_name,
                time_list,
                stat_file_name,
                len(time_list), 1)

            # for each chunk i, add stat into final return_dict
            stat_dict.update({
                i: return_stat.get(0, (0, 0, 0, 0))
            })

        # create graph based on stats of all clients
        generate_bar_chart_stat(
            stat_dict,
            'Concurrent Subscription Stat - per client '
            '({} clients)'.format(num_clients),
            'stat-per-client-{}-clients.svg'.format(num_clients),
            'client'
        )
Exemplo n.º 24
0
def write_stat_per_test_bucketized(time_result_dict, is_attach=True):
    stat_dict = {}
    return_stat = {}
    num_clients = len(time_result_dict)
    for i in range(10):
        chunks_bucket_i = []
        for j in range(len(time_result_dict)):
            if is_attach:
                time_list = time_result_dict.get('thread-{}'.format(j))[2]
            else:
                time_list = time_result_dict.get('thread-{}'.format(j))
            # slice out bucket-size from each client's result and merge
            chunks_bucket_i += time_list[i * 125:(i + 1) * 125]
        # for each chunk i, compute and output its stat
        return_stat = generate_stat_for_concurrent_thread(
            'bucket-{}'.format(i), chunks_bucket_i, 'csv-test-per-client.csv',
            len(chunks_bucket_i), 1)
        # for each chunk i, add stat into final return_dict
        stat_dict.update({i: return_stat.get(0, (0, 0, 0, 0))})
    # create graph based on stats of all chunks
    generate_line_chart_bucketized_stat(
        stat_dict, 'Concurrent Subscription Stat - per test bucketized '
        '({} clients)'.format(num_clients),
        'stat-test-bucketized-{}-clients.svg'.format(num_clients), 500, 10)