)]}'
{"ceilometer/compute/libvirt.py":[{"author":{"_account_id":5679,"name":"Yaniv Kaul","email":"ykaul@redhat.com","username":"ykaul"},"change_message_id":"bd14e584cdeb517154cf86243cdb0ea101c42759","unresolved":false,"context_lines":[{"line_number":151,"context_line":""},{"line_number":152,"context_line":"    utilization_map \u003d {}"},{"line_number":153,"context_line":"    # TODO(eglynn): there is probably a better way of determining"},{"line_number":154,"context_line":"    #               the total number of cores on-host"},{"line_number":155,"context_line":"    cores \u003d [int(line.strip()[-1]) for line in open(\u0027/proc/cpuinfo\u0027, \u0027r\u0027) if \\"},{"line_number":156,"context_line":"             line.startswith(\u0027processor\u0027)][-1] + 1"},{"line_number":157,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5GI%3D","line":154,"updated":"2012-10-30 13:50:58.000000000","message":"indeed - you are counting logical processors, not cores (which is perhaps what you wanted in the first place). I have for example 2 cores and 4 processor (x86info reports 1 dual-core processor with hyper-threading (2 threads per core)","commit_id":"f8ffad35e8856bb6fdf703d91a4839a39cba49af"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"unresolved":false,"context_lines":[{"line_number":152,"context_line":"    utilization_map \u003d {}"},{"line_number":153,"context_line":"    # TODO(eglynn): there is probably a better way of determining"},{"line_number":154,"context_line":"    #               the total number of cores on-host"},{"line_number":155,"context_line":"    cores \u003d [int(line.strip()[-1]) for line in open(\u0027/proc/cpuinfo\u0027, \u0027r\u0027) if \\"},{"line_number":156,"context_line":"             line.startswith(\u0027processor\u0027)][-1] + 1"},{"line_number":157,"context_line":""},{"line_number":158,"context_line":"    def get_cpu_util(self, instance, cpu_info):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5Gc%3D","line":155,"updated":"2012-10-30 13:55:35.000000000","message":"It will be easier to test this logic if it is in a function.","commit_id":"f8ffad35e8856bb6fdf703d91a4839a39cba49af"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"unresolved":false,"context_lines":[{"line_number":157,"context_line":""},{"line_number":158,"context_line":"    def get_cpu_util(self, instance, cpu_info):"},{"line_number":159,"context_line":"        prev_times \u003d self.utilization_map.get(instance.uuid)"},{"line_number":160,"context_line":"        self.utilization_map[instance.uuid] \u003d [cpu_info[\u0027cpu_time\u0027],"},{"line_number":161,"context_line":"                                               datetime.datetime.now()]"},{"line_number":162,"context_line":"        cpu_util \u003d 0.0"},{"line_number":163,"context_line":"        if prev_times:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5GA%3D","line":160,"updated":"2012-10-30 13:55:35.000000000","message":"It looks like the map member should be a tuple instead of a list.","commit_id":"f8ffad35e8856bb6fdf703d91a4839a39cba49af"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"unresolved":false,"context_lines":[{"line_number":165,"context_line":"            prev_timestamp \u003d prev_times[1]"},{"line_number":166,"context_line":"            delta \u003d self.utilization_map[instance.uuid][1] - prev_timestamp"},{"line_number":167,"context_line":"            elapsed \u003d (delta.seconds * (10 ** 6) + delta.microseconds) * 1000"},{"line_number":168,"context_line":"            cores_fraction \u003d (instance.vcpus * 1.0 / self.cores if self.cores"},{"line_number":169,"context_line":"                              else 1.0)"},{"line_number":170,"context_line":"            time_used \u003d cpu_info[\u0027cpu_time\u0027] - prev_cpu"},{"line_number":171,"context_line":"            cpu_util \u003d 100 * cores_fraction * time_used / elapsed"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5Fs%3D","line":168,"updated":"2012-10-30 13:55:35.000000000","message":"This logic would be cleaner if we always make sure self.cores is valid or 1.0 where it is set.","commit_id":"f8ffad35e8856bb6fdf703d91a4839a39cba49af"}]}
