From patchwork Sat Nov 16 01:22:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1195999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513723-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="aXgiKKFj"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="TdJGH8Qe"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47FHRj385yz9s7T for ; Sat, 16 Nov 2019 12:18:57 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding; q=dns; s=default; b=KGD kfXSwstOmd6itLsuW8/dyynUPdXtpJ6P+WJGTBCyDu2IGmO5x2WCFq5QG+yss168 MthHQPOV8SOcN0Em6714bwB5pHyTzNnZzdUmV/wu2RcGkAGqCnPdjTb0i2/xUseC esO5H1KGQtHigGZlPJEnP/wQxWS0o9G4hMo1QcO4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding; s=default; bh=31cnqvGk2 NWovWXqRO+hmAO+Qmc=; b=aXgiKKFjzNI8PCC19a8rTgQCpgLeFJjCg5Y0Xqr5x EKJCB0rOW8ARl4gk84Qx/sbfwS3GmsiS3+udjRuXmb2RyVyLf0ngBwU7D7J0L3yf OKTSox3c229V/eObicgfeZKibYl6VzTm+mzBj+LvXUbWyfYOq4wxMyhiQYKY319E 3s= Received: (qmail 55566 invoked by alias); 16 Nov 2019 01:17:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 55484 invoked by uid 89); 16 Nov 2019 01:17:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=Private, HX-Languages-Length:1247, timer X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Nov 2019 01:17:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573867030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1SPoYcJcazWE/jdYoBwKJEdaf8WA6e/7cCVfeZ0fumA=; b=TdJGH8QeGBuooO7AsWxeXmCrE8uT8O2WTlUm5jCYH5V8DYRDlrLO+XNXu2w71YzTuuF82e VfOp2TMVctBNuH3tbSm2XL4NfHdrAk7RO6fGrxplAb54amwceplMVIXdkYk1+YhbUdJNFc QKU5WNbsZQV/LV1TWGpNX4oKg6dN+9U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-bh2EvrFjNU6yMK6Rl6_NqA-1; Fri, 15 Nov 2019 20:17:08 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCFDC800686 for ; Sat, 16 Nov 2019 01:17:07 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-32.phx2.redhat.com [10.3.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id F073310246FB; Sat, 16 Nov 2019 01:17:06 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 06/49] timevar.h: add auto_client_timevar class Date: Fri, 15 Nov 2019 20:22:53 -0500 Message-Id: <1573867416-55618-7-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1573867416-55618-1-git-send-email-dmalcolm@redhat.com> References: <1573867416-55618-1-git-send-email-dmalcolm@redhat.com> X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes This patch adds a class "auto_client_timevar", similar to auto_timevar, but for plugins to use on their own timing items that aren't in timevar.def gcc/ChangeLog: * timevar.h (class auto_client_timevar): New class. --- gcc/timevar.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/gcc/timevar.h b/gcc/timevar.h index ef404d0..d053ab7 100644 --- a/gcc/timevar.h +++ b/gcc/timevar.h @@ -256,6 +256,39 @@ class auto_timevar timevar_id_t m_tv; }; +/* An RAII class analogous to auto_timevar, but for a client item, + for use by plugins. */ + +class auto_client_timevar +{ + public: + auto_client_timevar (timer *t, const char *item_name) + : m_timer (t) + { + if (m_timer) + m_timer->push_client_item (item_name); + } + + explicit auto_client_timevar (const char *item_name) + : m_timer (g_timer) + { + if (m_timer) + m_timer->push_client_item (item_name); + } + + ~auto_client_timevar () + { + if (m_timer) + m_timer->pop_client_item (); + } + + private: + // Private to disallow copies. + auto_client_timevar (const auto_client_timevar &); + + timer *m_timer; +}; + extern void print_time (const char *, long); #endif /* ! GCC_TIMEVAR_H */