Message ID | 20230328195228.701948-1-woodard@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <libabigail-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B45D3858C62 for <patchwork@sourceware.org>; Tue, 28 Mar 2023 19:52:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B45D3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680033162; bh=rrWeaafiqzgYX3BOaLh/O27C7i7qP246by14deUCpUg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=DVa+yl6wxA0lL36W8xkV2ZVuRSKjGv/db8rv8UN8Kjal8QUgeIpYIITj9eWp2rI5V 5tXwRHOSlatAW9js7zbeE916cUx+mj3WM4ZCDpUH+Ejv0C4ZS3w3H3IaFzsdiTxJKf XGPbyekuVCMlKniDfQMBSLc/zPdYBW8THKz0WKms= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 4B3C83858C54 for <libabigail@sourceware.org>; Tue, 28 Mar 2023 19:52:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B3C83858C54 Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-1jX19qDzNOWk6uNdS8byBw-1; Tue, 28 Mar 2023 15:52:35 -0400 X-MC-Unique: 1jX19qDzNOWk6uNdS8byBw-1 Received: by mail-pj1-f72.google.com with SMTP id k4-20020a17090aef0400b0023fcccbd7e6so3725798pjz.5 for <libabigail@sourceware.org>; Tue, 28 Mar 2023 12:52:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680033154; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rrWeaafiqzgYX3BOaLh/O27C7i7qP246by14deUCpUg=; b=sJwbJuv/QTUTaa9o75louFdPQM6zQxBqoonLQLRuxhP9TRVAkZGWP5z4QP9pt4ksLH g36wDeXybGq4xlMDLfF5ovHAyEIQdUojabqLKavrW5ugYI87GmbE9dVzk9HIAP3rsKwH +o7TDdjQ46hZPzOv7T8iALt0+NEi5wYWt0gVoWwQL9JbwmZz4H+zIdB52y2jXACrb/2U Rgxx0/Eif5DSrNxzlUwrfHYqZ/7wTSlNByb4DboHqS9mOrMMC/9Ch4sTamwXnDI0Vhq4 UoFKIHeaOb0D3Ooou4kBokOSl58wkvC2sMnotjbFuKdUzhjEiZWsHfeKP3SaMTuiIDwL GZ9g== X-Gm-Message-State: AAQBX9eAA1hd6G6/vB82jg0hlBdA8ML0qzDDAmqCbmBikDPukH5YUqlR dWJ7ZCcBlfs7OsAHrGp7GmKdDc4RPdP8aQgTrICL4R/4twrbyIqWAzQN/f/yQ5zR6XcWAf0Q9Q1 oVETAW0waB87eGysAI0ZTMZxnOB0+xdpJl5fZE5y49+9dNu02CfT9MR3bgrDELigW758x3Zvn5F m+pvQ= X-Received: by 2002:a17:90b:1d0e:b0:23d:bbcb:c97f with SMTP id on14-20020a17090b1d0e00b0023dbbcbc97fmr16492863pjb.1.1680033154360; Tue, 28 Mar 2023 12:52:34 -0700 (PDT) X-Google-Smtp-Source: AKy350ZXLK5BGkj5yiXD/ShXeduo5mO/hAVQ2NNVpOZDzgfUyt8Kk6ECeEPfTfwJIDlXilDHYuHy6g== X-Received: by 2002:a17:90b:1d0e:b0:23d:bbcb:c97f with SMTP id on14-20020a17090b1d0e00b0023dbbcbc97fmr16492839pjb.1.1680033153760; Tue, 28 Mar 2023 12:52:33 -0700 (PDT) Received: from darkstar.localdomain ([47.208.199.57]) by smtp.gmail.com with ESMTPSA id iz1-20020a170902ef8100b0019edc1b421asm10465315plb.163.2023.03.28.12.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 12:52:33 -0700 (PDT) To: libabigail@sourceware.org Cc: Ben Woodard <woodard@redhat.com> Subject: [PATCH] Have fedabipkgdiff sleep while waiting for abipkgdiff Date: Tue, 28 Mar 2023 12:52:28 -0700 Message-Id: <20230328195228.701948-1-woodard@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project <libabigail.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libabigail>, <mailto:libabigail-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libabigail/> List-Help: <mailto:libabigail-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libabigail>, <mailto:libabigail-request@sourceware.org?subject=subscribe> From: Ben Woodard via Libabigail <libabigail@sourceware.org> Reply-To: Ben Woodard <woodard@redhat.com> Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" <libabigail-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Have fedabipkgdiff sleep while waiting for abipkgdiff
|
|
Commit Message
Ben Woodard
March 28, 2023, 7:52 p.m. UTC
While running tests, I noticed that python was consuming a huge amount
of CPU. Frank ch Eiger fche@redhat.com located the problem and pointed
out that python was continiously polling for abipkgdiff's
completion. For small packages, the time to completion can be less
than a second but some packages can take literally hours to
analyze. Having python spinning in such a tight loop is unnecessary. I
added a small sleep to this loop with a bit of backoff. Vanessa Sochat
helped with examples of how to fix the python code.
* tools/fedabipkgdiff add sleep while waiting for subprocess
completion.
Signed-off-by: Ben Woodard <woodard@redhat.com>
---
tools/fedabipkgdiff | 6 ++++++
1 file changed, 6 insertions(+)
Comments
Hello, Ben Woodard via Libabigail <libabigail@sourceware.org> a écrit: > While running tests, I noticed that python was consuming a huge amount > of CPU. Frank ch Eiger fche@redhat.com located the problem and pointed > out that python was continiously polling for abipkgdiff's > completion. For small packages, the time to completion can be less > than a second but some packages can take literally hours to > analyze. Having python spinning in such a tight loop is unnecessary. I > added a small sleep to this loop with a bit of backoff. Vanessa Sochat > helped with examples of how to fix the python code. > > * tools/fedabipkgdiff add sleep while waiting for subprocess > completion. Thanks Ben! I have just slightly edited the ChangeLog to make it comply with the rules (i.e, adding the name of the changed function). I have also updated the copyright year that is outdated. > Signed-off-by: Ben Woodard <woodard@redhat.com> Please find below the patch that was applied to mainline. Cheers, From 1174a9f0c428149e21115401c44c648b3aaa2678 Mon Sep 17 00:00:00 2001 From: Ben Woodard <woodard@redhat.com> Date: Tue, 28 Mar 2023 12:52:28 -0700 Subject: [PATCH] Have fedabipkgdiff sleep while waiting for abipkgdiff While running tests, I noticed that python was consuming a huge amount of CPU. Frank Eigler located the problem and pointed out that python was continiously polling for abipkgdiff's completion. For small packages, the time to completion can be less than a second but some packages can take literally hours to analyze. Having python spinning in such a tight loop is unnecessary. I added a small sleep to this loop with a bit of backoff. Vanessa Sochat helped with examples of how to fix the python code. * tools/fedabipkgdiff (abipkgdiff): add sleep while waiting for subprocess completion. Also, update copyright year notice to 2023. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> --- tools/fedabipkgdiff | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff index db23d5a3..86bf0048 100755 --- a/tools/fedabipkgdiff +++ b/tools/fedabipkgdiff @@ -3,7 +3,7 @@ # -*- coding: utf-8 -*- # -*- Mode: Python # -# Copyright (C) 2013-2016 Red Hat, Inc. +# Copyright (C) 2013-2023 Red Hat, Inc. # # Author: Chenxiong Qi @@ -20,6 +20,7 @@ import shutil import six import subprocess import sys +import time from collections import namedtuple from itertools import chain @@ -1187,9 +1188,14 @@ def abipkgdiff(cmp_half1, cmp_half2): # then we get its output. # + sleeptime = 0.2 while True: if proc.poll() != None: break + time.sleep(sleeptime) + # cap the sleep time at 1.6s + if sleeptime < 2.0: + sleeptime = sleeptime * 2 stdout = ''.join(proc.stdout.readlines()) stderr = ''.join(proc.stderr.readlines())
diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff index db23d5a3..2867a8d0 100755 --- a/tools/fedabipkgdiff +++ b/tools/fedabipkgdiff @@ -20,6 +20,7 @@ import shutil import six import subprocess import sys +import time from collections import namedtuple from itertools import chain @@ -1187,9 +1188,14 @@ def abipkgdiff(cmp_half1, cmp_half2): # then we get its output. # + sleeptime = 0.2 while True: if proc.poll() != None: break + time.sleep(sleeptime) + # cap the sleep time at 1.6s + if sleeptime < 2.0: + sleeptime = sleeptime * 2 stdout = ''.join(proc.stdout.readlines()) stderr = ''.join(proc.stderr.readlines())