From patchwork Thu Apr 25 18:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 793227 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E309414D2B4 for ; Thu, 25 Apr 2024 18:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068463; cv=none; b=kObz/oBjkmDva8fBLf2P+zlCZRgo1r7+biZb9TUgSCuU6raG7AAwnh6Ih6/XHJw/KZAvRirsMj5idxlj3a3IgjmLvWnZIuWSdOjF5xe3fMVGgK78jlMkLd0tdANG3/9LHRFNFy3hGUOhfBJmvex9jh/4z2bFB4VvAb5sXGWLOas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068463; c=relaxed/simple; bh=6o7uNvE/GsvvpLIv9enSeqPYWrV5ztrOqmWNZwljm0k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LxFXo0YCsqumLkHrPYSmVcu6gF0w0GdQ1iFi7C7hkYNQW5W+qyr09QcKoBQGox6UJdvEABFABeUJRjZ9Kw3lAdHl/41zxDM4Dgtg+9MwDLqRaUJCt4CJHMRSpB8SRJ9abBqZngp75AMlzY2uSMQpiHNM4+0La/q92uIZ7CAV0tU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=he2d2DVp; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="he2d2DVp" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-434b7ab085fso18930961cf.1 for ; Thu, 25 Apr 2024 11:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714068460; x=1714673260; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=Cvc9pR/9UY/A3SmU6Sf3xBAu6VfUjGLnkxGXVX/XFE8=; b=he2d2DVpesaGXqeICwpXiSEexUM5QoKk4G7mgLnivQH3F0yFdn3f8/FQMYsBsEpETC SXknOxVXMIj3Ob8+fwhIyo4nTtfO/5yOBTRtEYTAmEHU99HNwlY96W5kJlrg6CdcXPVY V+QraFwJc1Z5Qz82L1Bql6zergF60g5mOGVAR53+UiGvpKFnVUrAaDF18E/jwi7LjdaD kU9NIap5qvy/YGgCXhs+/wMfzxCp8qnhOy/L6AXBmc0MEd7xgujCqZTbNo2r5zOCCC51 0RZVAXNO61bJafTBdIC2FvgPSHLvSJaRVO+gBJg8/a57vNjSGs2O5vn2/0eyvkym2kQ5 c63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714068460; x=1714673260; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Cvc9pR/9UY/A3SmU6Sf3xBAu6VfUjGLnkxGXVX/XFE8=; b=RWm5RaeSpUdgnQk+JdAJTcMJiujrBVeD9w/aQEIVZ9PfLA5AHpevLqCd7CrbOgC3PB GEx9sfu0cHVn6bH7o00CGfLgbRsLIAzK3I2XNOrB3xZQZfq5kZbgNW+jY9BDadTtU+5n ToHe3YuZeoqCY5s/yZrNnot2XvYleqnW/JCgD2ihmMx8tJjH4amJM9jIV8vCfAFKnjq2 xDPQruidDv/RLQSrwnDkZdNITS2v54OBS6C2ZaM68DxIAq/nnuBM4jxmN+R4vckOWQF9 KxwDfXFEAxnXIFa2QxrtUgKoDptSbD1qoLjaJMhSMeaRYQrxhLeevKvpYLqiOaX+oOAX Tg4g== X-Gm-Message-State: AOJu0Yw1ubpn8aUEJSsq3HOaoRTybUCCgDQdF8Hk95jhcKXK7E5v7VR8 aS1Q7eUFDtzSyp+1r+RzIH332d6HjTHf0I1mjIJKXStuuAy8LZ5+6Bk0HQ== X-Google-Smtp-Source: AGHT+IFjipjM9a+9AZkU+bw5fjyTH8HVQM7mc4U4PsPylP9Ccr7rnm6VnrTEW3XJAcGnVJW/rtj2ZA== X-Received: by 2002:a05:6214:c8b:b0:69b:60b6:7c5d with SMTP id r11-20020a0562140c8b00b0069b60b67c5dmr5161513qvr.18.1714068460056; Thu, 25 Apr 2024 11:07:40 -0700 (PDT) Received: from fionn.redhat.com ([74.12.5.183]) by smtp.gmail.com with ESMTPSA id n5-20020a0cdc85000000b0069b7c8ced6asm2103931qvk.12.2024.04.25.11.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:07:39 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Daniel Bristot de Oliveria , Juri Lelli , Kate Carcia Poulin , John Kacur Subject: [PATCH 1/4] rteval: cyclictest.py: Fix the description in the xml report Date: Thu, 25 Apr 2024 14:07:20 -0400 Message-ID: <20240425180723.66499-1-jkacur@redhat.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If the __type is 'system' we should add the description to the xml The output should be something like this Before this fix it was Signed-off-by: John Kacur --- rteval/modules/measurement/cyclictest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index 671426e13c4d..48b86a03cbfc 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -25,7 +25,7 @@ class RunData: self.__id = coreid self.__type = datatype self.__priority = int(priority) - self.__description = '' + self.description = '' # histogram of data self.__samples = {} self.__numsamples = 0 @@ -130,7 +130,7 @@ class RunData: def MakeReport(self): rep_n = libxml2.newNode(self.__type) if self.__type == 'system': - rep_n.newProp('description', self.__description) + rep_n.newProp('description', self.description) else: rep_n.newProp('id', str(self.__id)) rep_n.newProp('priority', str(self.__priority)) From patchwork Thu Apr 25 18:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 792235 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2681714E2F6 for ; Thu, 25 Apr 2024 18:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068464; cv=none; b=nTGKAF66lc+6bDGOG0o5CeKYVGYVBjyoNGAgqLFEEWZcDfT3+gBKM8By7uMI5RwlO913DE9jHRwOj6eGRKfBfoPgOFguDoxtHHVLr38CCHQkibLLR+pOvsCYPphSRFuOXAlE9HsVsmWxIOyTlH9vlEY1qmmOh+jJq/mcH1TkiU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068464; c=relaxed/simple; bh=CM4B9+qAcVnI1XV7OjqRTibeaaRJbsi3N9KI0NnrpgY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eaz0eYwCIbi9PkAslDAyLTf596RcPtD17Ok/FWdkt645h1NrZBILEf6YcBm9j8Q5YMnx4nAba0qEnB2ZoGtKB7UneEj2T2jkTPIkkJAUIVgfC5YorHD0LZEd3rd45ULY63Sx1iFVFiIGvBwkXMw6NjnkGcjpnEaD9LbpnpgX6Hs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lu32wi54; arc=none smtp.client-ip=209.85.219.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lu32wi54" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-69b40061bbeso7595346d6.1 for ; Thu, 25 Apr 2024 11:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714068462; x=1714673262; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=viEwlfKmx8SecYACMb9XiSoxhLtdQcPbWOh7hUeOi4w=; b=lu32wi54RtYm3cp3wkFrSPomXJikDg0YipR4+zqgDVor2SWH7U74pcTAaOXKDLS9NW EQSge164N87klix/mmKORAI3h5U/sn0hDqz5jXJgu+gMW0gSz/S0GBUewxP/F1xI3x63 ZWDLw2ISooWJj8xk1hlyJCzAMAUiZqzddznRBcoJUpV1qhDdP0Ruoz+NicmpKBbOUTpR 46ZmZezxXsDg8NPD68ctaLCRTnO+J241zu8CJ+79kxvKsxbpWJF8FIbWZhWpmtEXNB/8 hGk//6cX4ld7GoBJoPewF8CzXdE38b37nIFnLEsxm11asLcTf5EjA81WK8iHZO3Mthh4 fc5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714068462; x=1714673262; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=viEwlfKmx8SecYACMb9XiSoxhLtdQcPbWOh7hUeOi4w=; b=Dg9RlSYARiMGumQy3+GOmjMeS6SlTTomT6HmHuoenxk+T4gRB2CQLHFrMlUmL915Cp zIvaYnkfXGX3cVP0bURj8Hw1yqvpvJkb1gFEe7lFh/vCCTOu5bgAwXxX75faut7wdM7g vuByGmhy1xPxBBuryHeV5XxiP9zqvaN0cZh+2ahY4wgvKbBh2v/R9YrlbTOj6D9wS3OK GLjXdt7tWrpbSwlyVVRSD3yMxiJMHELsZ+r2RDnwESd+wo+MVFbFl6bPFt41kWuLOmml g7EjKLEnk6x5FXUk6oqGds1/fssdQmhhQa0+MFeWzYgrFboLVNqBeKZLJ2rCQVlwpW5z 7cpA== X-Gm-Message-State: AOJu0YzhrVGtpRT0hMfrjj4wPWDBfxOk9y2vqgHck81QTAnDAe3EnZIw iCciiWiBnqVVxKZMRjrik0Yj9YP08MUi86+d4YQ4rrJh0ZHbYzk/5xtEIQ== X-Google-Smtp-Source: AGHT+IH8ZuvJtK/ST8iLs6BiJhDlge3TZYGjy2jegPNRMOMldgeDhXyK39TXmEL0WYwZbfudZQDsCw== X-Received: by 2002:a05:6214:29e9:b0:69b:5ecd:7c9a with SMTP id jv9-20020a05621429e900b0069b5ecd7c9amr595685qvb.51.1714068461503; Thu, 25 Apr 2024 11:07:41 -0700 (PDT) Received: from fionn.redhat.com ([74.12.5.183]) by smtp.gmail.com with ESMTPSA id n5-20020a0cdc85000000b0069b7c8ced6asm2103931qvk.12.2024.04.25.11.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:07:40 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Daniel Bristot de Oliveria , Juri Lelli , Kate Carcia Poulin , John Kacur Subject: [PATCH 2/4] rteval: cyclictest.py: Remove unused method sample Date: Thu, 25 Apr 2024 14:07:21 -0400 Message-ID: <20240425180723.66499-2-jkacur@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240425180723.66499-1-jkacur@redhat.com> References: <20240425180723.66499-1-jkacur@redhat.com> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the unused method sample() in class RunData Signed-off-by: John Kacur --- rteval/modules/measurement/cyclictest.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index 48b86a03cbfc..1ba8b8b2323c 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -61,12 +61,6 @@ class RunData: if value < self.__min: self.__min = value - def sample(self, value): - self.__samples[value] += self.__samples.setdefault(value, 0) + 1 - self.update_max(value) - self.update_min(value) - self.__numsamples += 1 - def bucket(self, index, value): self.__samples[index] = self.__samples.setdefault(index, 0) + value if value: From patchwork Thu Apr 25 18:07:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 793226 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9252814D2B4 for ; Thu, 25 Apr 2024 18:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068466; cv=none; b=b5QNANtcKFkkl2BubCk2ZX6KRx4qvnr5auWHm6aY9UvYeYd7OOhxe/5yvxxnPqPNZVV0VjQTfJ/UGsfrTIf/fbnNBI1pUGYzLc4Ba5QX292/tzsJUvRjgzNXxFx1Z6D+1/pMqrhn3v9zeQBsPT/MPH7jUtawhhCoqt/6qO6Erz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068466; c=relaxed/simple; bh=ZK1BvbMXtAbw08OTZ3c6MQtLfcAl+2AhRHB5JHKLO3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fLpaZzHkJLINWtnyBl42AEK3naFlckTYxntvLgI80VHrRk6VGke4F9Zo7JBph+TFq1DW4dv0tYtxvbNIz6QXqG93J6gA4zn3cWvaMxmllk+C6aHtKA9AQYl7U/CjD1NqWgsWiaUwymCyKYsVZoRuIBMAUxkFl09Q9mu76tq+eBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lWbZLyUJ; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lWbZLyUJ" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78f043eaee9so73356285a.3 for ; Thu, 25 Apr 2024 11:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714068463; x=1714673263; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=ves3/vHu99sdJKzcDwdHqkLZxl0bM02aSC8+OmKsR54=; b=lWbZLyUJrTlX9mU26aTA3jNc03maErYkUr/s9hM2N2YMdVG/g4gL3RdSoZwIH23RpY 6VrlXYwCjYojqaDZl4dsyUEpFbDiodApHvn6bQE03vfbV9Px0mKyULWDX5TadXPOon6l 2gNq/FghGoBwQ5Hmbldxbdc2GuOePSzTZqRE0iws6a2+lq02ui6IcbxCwGypS3lcOJlD /G23e8w6Y9ob02krg5ME9MJB79qXBDF9HE08ylXHmyh4/I82hZjSaZMxqoFjFn/E4ZNU vZHtNP4euDpxHQTXCISbEuKyAk3SE7FLHxVPbeK+q66ncFJoozwtl5klKHdoO7x5gDNR qbnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714068463; x=1714673263; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ves3/vHu99sdJKzcDwdHqkLZxl0bM02aSC8+OmKsR54=; b=LiaZJW8CqYgE/QnAq0T3xMS7TzzzkFfXBlTo3ZICf6GlIqasPnoUJj8dO8vUqIv1bZ YLTjSVSHN7Z6vHFFjXb7tO7BtT4ZJ3TQOez1EKgG3B20EpqVVx8xtKO9c8/zV4I2jzJs PjG0wGx2JCcX2a2ZD446MdXVEnwsDOUbcO3e4OKebR0cXkd8mWazgcwhjhMUttJIwd8D GfskRZHsZVUmmNayZpKGPE8zhWiJ6v62TCqGTZPcdWnQFu+fLH6MQVvPpenjG9glRz7t DcTitmAuD8QrVx0BycpCWD6T9NoJUtTEDUEf8A3+hiKmWKyCPRDJoENeK7xZNCjp7RP5 40YQ== X-Gm-Message-State: AOJu0Yyj8lo+LrqNkbUDOhhFO3qcT06gjScv50EE39Oeqr3C929Tl6pw hld678X6eszxDqG3YUnZ1qu3OBB7VI9Ce0YY4by1UbFMdsZ9UpldolFE7g== X-Google-Smtp-Source: AGHT+IEki/7LhAcVxecJvENe1v8gsZ38deXowPc6YWY3Y+2X7ieZdUymemlR9crouugOtBZUlzLouQ== X-Received: by 2002:ad4:5ca7:0:b0:6a0:48f1:6148 with SMTP id q7-20020ad45ca7000000b006a048f16148mr583679qvh.27.1714068462768; Thu, 25 Apr 2024 11:07:42 -0700 (PDT) Received: from fionn.redhat.com ([74.12.5.183]) by smtp.gmail.com with ESMTPSA id n5-20020a0cdc85000000b0069b7c8ced6asm2103931qvk.12.2024.04.25.11.07.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:07:42 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Daniel Bristot de Oliveria , Juri Lelli , Kate Carcia Poulin , John Kacur Subject: [PATCH 3/4] rteval: cyclictest.py: Fix the median calculation Date: Thu, 25 Apr 2024 14:07:22 -0400 Message-ID: <20240425180723.66499-3-jkacur@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240425180723.66499-1-jkacur@redhat.com> References: <20240425180723.66499-1-jkacur@redhat.com> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix the calculation of the median in rteval for cyclictest Signed-off-by: John Kacur --- rteval/modules/measurement/cyclictest.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index 1ba8b8b2323c..cef73abd1b4b 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -80,26 +80,34 @@ class RunData: return self._log(Log.INFO, f"reducing {self.__id}") - total = 0 + total = 0 # total number of samples + total_us = 0 keys = list(self.__samples.keys()) keys.sort() - mid = self.__numsamples / 2 + # if numsamples is odd, then + 1 gives us the actual mid + # if numsamples is even, we avg mid and mid + 1, so we actually + # want to know mid + 1 since we will combine it with mid and + # the lastkey if the last key is at the end of a previous bucket + mid = int(self.__numsamples / 2) + 1 # mean, mode, and median occurances = 0 lastkey = -1 for i in keys: - if mid > total and mid <= (total + self.__samples[i]): - if self.__numsamples & 1 and mid == total+1: + if mid > total and mid <= total + self.__samples[i]: + # Test if numsamples is even and if mid+1 is the next bucket + if self.__numsamples & 1 != 0 and mid == total+1: self.__median = (lastkey + i) / 2 else: self.__median = i - total += (i * self.__samples[i]) + lastkey = i + total += self.__samples[i] + total_us += (i * self.__samples[i]) if self.__samples[i] > occurances: occurances = self.__samples[i] self.__mode = i - self.__mean = float(total) / float(self.__numsamples) + self.__mean = float(total_us) / float(self.__numsamples) # range for i in keys: From patchwork Thu Apr 25 18:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 792234 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE6314F118 for ; Thu, 25 Apr 2024 18:07:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068468; cv=none; b=cpixubCjtMw2oxkzf2halpo/7DjlAoqj75xWWnDAVaXNOUxP0gFmzCjyExpmhV82Mg7qzxAeAhs7xugou9sH/qzxsNS9QyyecO5d6DVThbD2jZ1+rjfkzMis67YqPCSYeJU6pI+8GCQAZIX3qdlRH5LMMZ3MAPh08zG6N6vLvHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714068468; c=relaxed/simple; bh=ePm/6up5fLhOqSqCorHerJk8LojZDdgaFfmLuaZtXnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aX4IFVpTx6gAwvoCYXTE/8vOo9FX3CBAEqIDLF1AV5ugvxukbgvBfsT42oBOZhezzoRF61KcNoXB7NqNQKhsO8nXw/MQR2bxRFmgv3lwzqvirqqhKdPpAvaBJFiOZ88NYKghwB+0nmX5IqKx85jBg67B+6vebTwhOB1/nw06mrs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dN5uG/CF; arc=none smtp.client-ip=209.85.219.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dN5uG/CF" Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-69b6d36b71cso8977856d6.3 for ; Thu, 25 Apr 2024 11:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714068464; x=1714673264; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=9ikcKqd3zYYDXNyUhMBWkLtYQk1f4ScT9rkX3RTEbeg=; b=dN5uG/CFqnGJT7B/+9B0zr16iIiY5IFg+D3f64B8nfNK7K+3XZQ40fDN/EoM0myJ6h hdqrAoGhWp0S0tRRpWETBV4CZupC9mTXh6cNBA0+w4r3PWpT0OAGUHve5hBFKKnIYXZD CLkRJjHoB9DavuywQNrfjduYETi+ty9OxoIZb82DVV7+f1hcPRy6sK9u9UtlEJYVLFzm FkL7ZYPSgcEOZlLNcb5hQXW/lTkmJ8ZoYn2owwjKNia6SHCuvDj9wh7N2vqFRsDdkaWs vVhZTjPD5Ax2zyeWhzDZvcOZmZWn1tje5WHiNBl5my5z/rwogi2riaP48qbZvDjIlM4D QytA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714068464; x=1714673264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9ikcKqd3zYYDXNyUhMBWkLtYQk1f4ScT9rkX3RTEbeg=; b=OU4T3pp+h5DTb8ukKBycj7vbsm7a04t8CgIcIpLNWoe9yg3FCldWhE5X/Exts9fNsp 9B9TklJWth66T7mSSPJ/hM0FHKjHfdHRlbpEY5RXYAKeZE0+DCFWnl1MstMcdUnpbUCJ rs/n5iATAwX9XrQDctZWtyjcjCfPi6y9PomhBDOIFYK58NBITXS/yGNoXP5umj1vo9Gj Ni8ATs7ou6r+h8FjyRz8AXDnScOAr7NhepV7fQwYm1fRcrSLb+ZevCO+iHxI4mTjOubY t5Lbk/jrFV0ozsc0vMn22MjZwTTzh1ybZmJfmUHtCV23ts3BoX4YUb7E8Nw6HqNilWnI QrGQ== X-Gm-Message-State: AOJu0Yx047dPvZxkpdE6k52CIvo80/+QWRO/wDadzV4yioargbvbb5QJ LH4oDPh63jAGf8eNiFA3tkuCb34jSS4fgJSP4sWtk/C3EPdcCgTuFsV1CA== X-Google-Smtp-Source: AGHT+IEp4ETfVGB5bhTHqD2VXmaFKJDwLUtdcl0ImdNUyA1fuNRmG/UFlXyHhmCfr/OvHzmSdnkmPA== X-Received: by 2002:a05:6214:5092:b0:6a0:a7c8:1acb with SMTP id kk18-20020a056214509200b006a0a7c81acbmr589281qvb.2.1714068464243; Thu, 25 Apr 2024 11:07:44 -0700 (PDT) Received: from fionn.redhat.com ([74.12.5.183]) by smtp.gmail.com with ESMTPSA id n5-20020a0cdc85000000b0069b7c8ced6asm2103931qvk.12.2024.04.25.11.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:07:43 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Daniel Bristot de Oliveria , Juri Lelli , Kate Carcia Poulin , John Kacur Subject: [PATCH 4/4] rteval: timerlat.py Add statistics and generate xml Date: Thu, 25 Apr 2024 14:07:23 -0400 Message-ID: <20240425180723.66499-4-jkacur@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240425180723.66499-1-jkacur@redhat.com> References: <20240425180723.66499-1-jkacur@redhat.com> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds calculating statitics such as samples (count), min, max, mean, median, mode, range, absolute and standard deviations to xml Currently it combines the kernel thread, IRQs and userspace threads into one statistic like it does with cyclictest, but in the future we can separate this out too. To see this functioning from git, do this, su -c 'python rteval/modules/measurement/timerlat.py ' Signed-off-by: John Kacur --- rteval/modules/measurement/timerlat.py | 266 ++++++++++++++++++++++++- 1 file changed, 259 insertions(+), 7 deletions(-) diff --git a/rteval/modules/measurement/timerlat.py b/rteval/modules/measurement/timerlat.py index d4e78de8d2a2..9fa931043e40 100644 --- a/rteval/modules/measurement/timerlat.py +++ b/rteval/modules/measurement/timerlat.py @@ -8,12 +8,170 @@ import subprocess import signal import time import tempfile +import math +import sys import libxml2 from rteval.Log import Log from rteval.modules import rtevalModulePrototype from rteval.systopology import cpuinfo, SysTopology from rteval.cpulist_utils import expand_cpulist, collapse_cpulist +class TLRunData: + ''' class to store instance data from a timerlat run ''' + def __init__(self, coreid, datatype, priority, logfnc): + self.__id = coreid + self.__type = datatype + self.__priority = int(priority) + self.description = '' + self._log = logfnc + self.duration = '' + # histogram data, irqs, kernel threads and user threads per core + self.irqs = {} + self.thrs = {} + self.usrs = {} + self.__samples = {} + self.__numsamples = 0 + self.min = 100000000 + self.max = 0 + self.__stddev = 0.0 + self.__mean = 0.0 + self.__mode = 0.0 + self.__median = 0.0 + self.__range = 0.0 + + def update_max(self, value): + """ highest bucket with a value """ + if value > self.max: + self.max = value + + def update_min(self, value): + """ lowest bucket with a value """ + if value < self.min: + self.min = value + + def bucket(self, index, val1, val2, val3): + """ Store results index=bucket number, val1=IRQ, val2=thr, val3=usr """ + values = val1 + val2 + val3 + self.__samples[index] = self.__samples.setdefault(index, 0) + values + self.irqs[index] = val1 + self.thrs[index] = val2 + self.usrs[index] = val3 + if values: + self.update_max(index) + self.update_min(index) + self.__numsamples += values + + def reduce(self): + """ Calculate statistics """ + # Check to see if we have any samples. If there are 1 or 0, return + if self.__numsamples <= 1: + self._log(Log.DEBUG, f"skipping {self.__id} ({self.__numsamples} sampples)") + self.__mad = 0 + self.__stddev = 0 + return + + self._log(Log.INFO, f"reducing {self.__id}") + total = 0 # total number of samples + total_us = 0 + keys = list(self.__samples.keys()) + keys.sort() + + # if numsamples is odd, then + 1 gives us the actual mid + # if numsamples is even, we avg mid and mid + 1, so we actually + # want to know mid + 1 since we will combine it with mid and + # the lastkey if the last key is at the end of a previous bucket + mid = int(self.__numsamples / 2) + 1 + + # mean, mode and median + occurances = 0 + lastkey = -1 + for i in keys: + if mid > total and mid <= total + self.__samples[i]: + # Test if numsamples is even and if mid+1 is the next bucket + if self.__numsamples & 1 != 0 and mid == total+1: + self.__median = (lastkey + i) / 2 + else: + self.__median = i + lastkey = i + total += self.__samples[i] + total_us += i * self.__samples[i] + if self.__samples[i] > occurances: + occurances = self.__samples[i] + self.__mode = i + self.__mean = float(total_us) / float(self.__numsamples) + + # range + for i in keys: + if self.__samples[i]: + low = i + break + high = keys[-1] + while high and self.__samples.setdefault(high, 0) == 0: + high -= 1 + self.__range = high - low + + # Mean Absolute Deviation and Standard Deviation + madsum = 0 + varsum = 0 + for i in keys: + madsum += float(abs(float(i) - self.__mean) * self.__samples[i]) + varsum += float(((float(i) - self.__mean) ** 2) * self.__samples[i]) + self.__mad = madsum / self.__numsamples + self.__stddev = math.sqrt(varsum / (self.__numsamples - 1)) + + + def MakeReport(self): + rep_n = libxml2.newNode(self.__type) + + if self.__type == 'system': + rep_n.newProp('description', self.description) + else: + rep_n.newProp('id', str(self.__id)) + rep_n.newProp('priority', str(self.__priority)) + + stat_n = rep_n.newChild(None, 'statistics', None) + stat_n.newTextChild(None, 'samples', str(self.__numsamples)) + + if self.__numsamples > 0: + n = stat_n.newTextChild(None, 'minimum', str(self.min)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'maximum', str(self.max)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'median', str(self.__median)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'mode', str(self.__mode)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'range', str(self.__range)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'mean', str(self.__mean)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'mean_absolute_deviation', str(self.__mad)) + n.newProp('unit', 'us') + + n = stat_n.newTextChild(None, 'standard_deviation', str(self.__stddev)) + n.newProp('unit', 'us') + + hist_n = rep_n.newChild(None, 'histogram', None) + hist_n.newProp('nbuckets', str(len(self.__samples))) + + keys = list(self.__samples.keys()) + keys.sort() + for k in keys: + if self.__samples[k] == 0: + # Don't report buckets without any samples + continue + b_n = hist_n.newChild(None, 'bucket', None) + b_n.newProp('index', str(k)) + b_n.newProp('value', str(self.__samples[k])) + + return rep_n + class Timerlat(rtevalModulePrototype): """ measurement modules for rteval """ def __init__(self, config, logger=None): @@ -23,6 +181,8 @@ class Timerlat(rtevalModulePrototype): self.__numanodes = int(self.__cfg.setdefault('numanodes', 0)) self.__priority = int(self.__cfg.setdefault('priority', 95)) + default_buckets = ModuleParameters()["buckets"]["default"] + self.__buckets = int(self.__cfg.setdefault('buckets', default_buckets)) self.__cpulist = self.__cfg.setdefault('cpulist', "") self.__cpus = [str(c) for c in expand_cpulist(self.__cpulist)] @@ -31,6 +191,20 @@ class Timerlat(rtevalModulePrototype): self.__timerlat_out = None self.__timerlat_err = None self.__started = False + + # Create a TLRunData object for each core we'll measure + info = cpuinfo() + self.__timerlatdata = {} + for core in self.__cpus: + self.__timerlatdata[core] = TLRunData(core, 'core', self.__priority, + logfnc=self._log) + self.__timerlatdata[core].description = info[core]['model name'] + + # Create a TLRunData object for the overall system + self.__timerlatdata['system'] = TLRunData('system', 'system', + self.__priority, + logfnc=self._log) + self.__timerlatdata['system'].description = (f"({self.__numcores} cores) ") + info['0']['model name'] self._log(Log.DEBUG, f"system using {self.__numcores} cpu cores") @@ -43,6 +217,7 @@ class Timerlat(rtevalModulePrototype): def _WorkloadPrepare(self): self.__cmd = ['rtla', 'timerlat', 'hist', '-P', f'f:{int(self.__priority)}', '-u'] self.__cmd.append(f'-c{self.__cpulist}') + self.__cmd.append(f'-E{self.__buckets}') self._log(Log.DEBUG, f'self.__cmd = {self.__cmd}') self.__timerlat_out = tempfile.SpooledTemporaryFile(mode='w+b') self.__timerlat_err = tempfile.SpooledTemporaryFile(mode='w+b') @@ -77,16 +252,82 @@ class Timerlat(rtevalModulePrototype): os.kill(self.__timerlat_process.pid, signal.SIGINT) time.sleep(2) - self._setFinished() - self.__started = False - - def MakeReport(self): + # Parse histogram output self.__timerlat_out.seek(0) for line in self.__timerlat_out: line = bytes.decode(line) - print(line) + + # Skip any blank lines + if not line: + continue + + if line.startswith('#'): + if line.startswith('# Duration:'): + duration = line.split()[2] + duration += line.split()[3] + self.__timerlatdata['system'].duration = duration + continue + elif line.startswith('Index'): + #print(line) + continue + elif line.startswith('over:'): + #print(line) + continue + elif line.startswith('count:'): + #print(line) + continue + elif line.startswith('min:'): + #print(line) + continue + elif line.startswith('avg:'): + #print(line) + continue + elif line.startswith('max:'): + #print(line) + continue + else: + pass + #print(line) + + vals = line.split() + if not vals: + # If we don't have any values, don't try parsing + continue + try: + # The index corresponds to the bucket number + index = int(vals[0]) + except: + self._log(Log.DEBUG, f'timerlat: unexpected output: {line}') + continue + + for i, core in enumerate(self.__cpus): + self.__timerlatdata[core].bucket(index, int(vals[i*3+1]), + int(vals[i*3+2]), + int(vals[i*3+3])) + self.__timerlatdata['system'].bucket(index, int(vals[i*3+1]), + int(vals[i*3+2]), + int(vals[i*3+3])) + # Generate statistics for each RunData object + for n in list(self.__timerlatdata.keys()): + self.__timerlatdata[n].reduce() + self.__timerlat_out.close() + self._setFinished() + self.__started = False + + def MakeReport(self): + rep_n = libxml2.newNode('timerlat') + rep_n.newProp('command_line', ' '.join(self.__cmd)) + + rep_n.addChild(self.__timerlatdata['system'].MakeReport()) + for thr in self.__cpus: + if str(thr) not in self.__timerlatdata: + continue + rep_n.addChild(self.__timerlatdata[str(thr)].MakeReport()) + + return rep_n + def ModuleInfo(): """ Required measurement module information """ @@ -97,7 +338,10 @@ def ModuleParameters(): """ default parameters """ return {"priority": {"descr": "Run rtla timerlat with this priority", "default": 95, - "metavar": "PRIO" } + "metavar": "PRIO" }, + "buckets": {"descr": "Number of buckets", + "default": 3500, + "metavar": "NUM"} } def create(params, logger): @@ -107,6 +351,10 @@ def create(params, logger): if __name__ == '__main__': from rteval.rtevalConfig import rtevalConfig + if os.getuid() != 0: + print("Must be root to run timerlat!") + sys.exit(1) + l = Log() l.SetLogVerbosity(Log.INFO|Log.DEBUG|Log.ERR|Log.WARN) @@ -128,4 +376,8 @@ if __name__ == '__main__': tl._WorkloadTask() time.sleep(RUNTIME) tl._WorkloadCleanup() - tl.MakeReport() + rep_n = tl.MakeReport() + + xml = libxml2.newDoc('1.0') + xml.setRootElement(rep_n) + xml.saveFormatFileEnc('-', 'UTF-8', 1)