From patchwork Tue Oct 1 20:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34777 Received: (qmail 42038 invoked by alias); 1 Oct 2019 20:12:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 41901 invoked by uid 89); 1 Oct 2019 20:12:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=COLOR, highlight X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.47.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Oct 2019 20:12:40 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 3B2ED7562A for ; Tue, 1 Oct 2019 15:12:38 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id FOVhi2dH3PUvSFOVhighOy; Tue, 01 Oct 2019 15:12:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vNdceuVS8D2wJeauEUBihYdSpTXy4IvrRTgP6thpHq0=; b=qrbnVod+jFf0vbKyHDT0ONDzR3 WeJlcLkkBclSfHGtkuVBT7bMO5o6eqk+h64hbmt4BmRniC298W1jBgx+vhgDzZ0wG9WnoB3kw/Wxy EOkpiM1EKjDEPuPAMKUxbD2Lp; Received: from 75-166-72-156.hlrn.qwest.net ([75.166.72.156]:47310 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iFOVh-0023p5-1A; Tue, 01 Oct 2019 14:12:37 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v4 10/11] Add maint set/show max-worker-threads Date: Tue, 1 Oct 2019 14:12:26 -0600 Message-Id: <20191001201227.8519-11-tom@tromey.com> In-Reply-To: <20191001201227.8519-1-tom@tromey.com> References: <20191001201227.8519-1-tom@tromey.com> This adds maint commands to control the maximum number of worker threads that gdb can use. gdb/ChangeLog 2019-10-01 Tom Tromey * NEWS: Add entry. * maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint commands. gdb/doc/ChangeLog 2019-10-01 Tom Tromey * gdb.texinfo (Maintenance Commands): Document new maint commands. --- gdb/ChangeLog | 6 ++++++ gdb/NEWS | 6 ++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 14 ++++++++++++++ gdb/maint.c | 12 ++++++++++++ 5 files changed, 43 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 779fd91d3a6..7d4988f6cb0 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -122,6 +122,12 @@ set style highlight background COLOR set style highlight intensity VALUE Control the styling of highlightings. +maint set max-worker-threads +maint show max-worker-threads + Control the maximum number of worker threads that can be used by GDB. + The default is "unlimited". Currently worker threads are only used when + demangling the names of linker symbols. + maint set test-settings KIND maint show test-settings KIND A set of commands used by the testsuite for exercising the settings diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f2713c03960..04a40091de4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -37663,6 +37663,20 @@ with the DWARF frame unwinders enabled. If DWARF frame unwinders are not supported for a particular target architecture, then enabling this flag does not cause them to be used. + +@kindex maint set max-worker-threads +@kindex maint show max-worker-threads +@item maint set max-worker-threads +@item maint show max-worker-threads +Control the number of worker threads that may be used by @value{GDBN}. +On capable hosts, @value{GDBN} may use multiple threads to speed up +certain CPU-intensive operations, such as demangling symbol names. +While the number of threads used by @value{GDBN} may vary, this +command can be used to set an upper bound on this number. The default +is @code{unlimited}. Note that this only controls worker threads +started by @value{GDBN} itself; libraries used by @value{GDBN} may +start threads of their own. + @kindex maint set profile @kindex maint show profile @cindex profiling GDB diff --git a/gdb/maint.c b/gdb/maint.c index ec9f4abb264..8428bea4f92 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -40,6 +40,7 @@ #include "top.h" #include "maint.h" #include "gdbsupport/selftest.h" +#include "gdbsupport/parallel-for.h" #include "cli/cli-decode.h" #include "cli/cli-utils.h" @@ -1312,4 +1313,15 @@ When enabled GDB is profiled."), show_maintenance_profile_p, &maintenance_set_cmdlist, &maintenance_show_cmdlist); + + add_setshow_zuinteger_unlimited_cmd ("max-worker-threads", + class_maintenance, + &gdb::max_threads, _("\ +Set the maximum number of worker threads GDB can use."), _("\ +Set the maximum number of worker threads GDB can use."), _("\ +GDB may use multiple threads to speed up certain CPU-intensive operations,\n\ +such as demangling symbol names."), + NULL, NULL, + &maintenance_set_cmdlist, + &maintenance_show_cmdlist); }