From bf59d27a58448cb33b29e19c5ed611df23775a89 Mon Sep 17 00:00:00 2001 From: peusterm Date: Tue, 26 Apr 2016 16:44:34 +0200 Subject: [PATCH] added logging for over provisioning model --- .../dcemulator/resourcemodel/upb/simple.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/emuvim/dcemulator/resourcemodel/upb/simple.py b/src/emuvim/dcemulator/resourcemodel/upb/simple.py index 08b3cf3..f4ec9ad 100644 --- a/src/emuvim/dcemulator/resourcemodel/upb/simple.py +++ b/src/emuvim/dcemulator/resourcemodel/upb/simple.py @@ -37,6 +37,8 @@ class UpbSimpleCloudDcRM(BaseResourceModel): self.deactivate_mem_limit = deactivate_mem_limit self.single_cu = 0 self.single_mu = 0 + self.cpu_op_factor = 1.0 # over provisioning factor + self.mem_op_factor = 1.0 self.raise_no_cpu_resources_left = True self.raise_no_mem_resources_left = True super(UpbSimpleCloudDcRM, self).__init__() @@ -136,8 +138,8 @@ class UpbSimpleCloudDcRM(BaseResourceModel): cpu_period, cpu_quota = self._calculate_cpu_cfs_values(cpu_time_percentage) # apply limits to container if changed if d.cpu_period != cpu_period or d.cpu_quota != cpu_quota: - LOG.debug("Setting CPU limit for %r: cpu_quota = cpu_period * limit = %f * %f = %f" % ( - d.name, cpu_period, cpu_time_percentage, cpu_quota)) + LOG.debug("Setting CPU limit for %r: cpu_quota = cpu_period * limit = %f * %f = %f (op_factor=%f)" % ( + d.name, cpu_period, cpu_time_percentage, cpu_quota, self.cpu_op_factor)) d.updateCpuLimit(cpu_period=int(cpu_period), cpu_quota=int(cpu_quota)) def _compute_single_cu(self): @@ -182,7 +184,8 @@ class UpbSimpleCloudDcRM(BaseResourceModel): mem_limit = self._calculate_mem_limit_value(mem_limit) # apply to container if changed if d.mem_limit != mem_limit: - LOG.debug("Setting MEM limit for %r: mem_limit = %f MB" % (d.name, mem_limit/1024/1024)) + LOG.debug("Setting MEM limit for %r: mem_limit = %f MB (op_factor=%f)" % + (d.name, mem_limit/1024/1024, self.mem_op_factor)) d.updateMemoryLimit(mem_limit=mem_limit) def _calculate_mem_limit_value(self, mem_limit): @@ -224,6 +227,8 @@ class UpbSimpleCloudDcRM(BaseResourceModel): r["dc_alloc_mu"] = self.dc_alloc_mu r["single_cu_percentage"] = self.single_cu r["single_mu_percentage"] = self.single_mu + r["cpu_op_factor"] = self.cpu_op_factor + r["mem_op_factor"] = self.mem_op_factor r["allocation_state"] = allocation_state return r @@ -279,9 +284,7 @@ class UpbOverprovisioningCloudDcRM(UpbSimpleCloudDcRM): # get cpu time fraction for entire emulation e_cpu = self.registrar.e_cpu # calculate over provisioning scale factor - self.op_factor = float(self.dc_max_cu) / (max(self.dc_max_cu, self.dc_alloc_cu)) - LOG.info("========== op_factor=%r ===========" % self.op_factor) + self.cpu_op_factor = float(self.dc_max_cu) / (max(self.dc_max_cu, self.dc_alloc_cu)) # calculate - return float(e_cpu) / sum([rm.dc_max_cu for rm in list(self.registrar.resource_models)]) * self.op_factor + return float(e_cpu) / sum([rm.dc_max_cu for rm in list(self.registrar.resource_models)]) * self.cpu_op_factor - # TODO log op_factor -- 2.25.1