From patchwork Tue Oct 3 18:30:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 728817 Delivered-To: patch@linaro.org Received: by 2002:a5d:60c8:0:b0:31d:da82:a3b4 with SMTP id x8csp2286197wrt; Tue, 3 Oct 2023 11:34:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEviccDh1vDxe1TAbWOziwUgcT7A5jX5SdjIpNU/CmZtodxrABRNvqQRZAsJfMzNXzlJYtq X-Received: by 2002:a0c:dd87:0:b0:658:a043:376b with SMTP id v7-20020a0cdd87000000b00658a043376bmr200835qvk.8.1696358056322; Tue, 03 Oct 2023 11:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358056; cv=none; d=google.com; s=arc-20160816; b=ankzU27k8AhgROR8ccCI2A+fNQFD8uF/O83tDxbR+mV1M1d+1+vEE6eIyCNvcLo4Cs 3oCCo8Gx4JKedFtU0RU5cUUD3ui52LdEEBWl0hmjo9TmL8DjG50Zx9XU9u7SdoasrQg9 kbT7Y1qAMkcBg6aIZZpydrwjNLJOVUTU/8u8mzbktzU/Q55c7u4moPewGFLoDlq3kPOi Edm68IpUHHnnkF1E0ZGYjzNq6QIdKeYghGPw8ezH2BHkDnEuLPgFDC3lSLhljJZtPtrt AaUOpsZ3ceng7TusxFWPoJiH/7JPywW5OZsia5gLo27ez4bJVkeA/5CCET/3YMilzqCR kqyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HBgYnkG/UUhR0Bh5p/v3uxe98ghyIsuRr/l/CO8AZ6c=; fh=Grk8ert1aVMPN1jf5/SpIQC06nonvH9hdZT9h94lZCY=; b=POVwFfFFjQoGOI8BQ9F39BvNTRcGpa4Y8WPdCFVlSYHoMpxTmiiwEx1mwIa2OdtnKZ PMLNWhMRGXbSXUm48YbCDorrBBvzfOEnM/uWjt9Y0n6Csw8FfB8k/EZsbD07hpDwn0ps mKXf/TP9c7CCwLhV1BcqssWO3RtkGFXvYzJtg4P2n98XEPYqqHGehzcLBPXMZifX8D/3 aLr+YC3eEVHXhXOmAx4KXTaqHnXyhVCwdPFTRkxw/d7ZbqSOZ/cHhSF79TbPmHzp158y 8ypRoszTPpdYDOP0czURnAx/o2dvUiePQuWw5ElSlbD3AYJd8D6UgjHWxDpsAdMBOAcc vAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u9lLVIA4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ea12-20020a05620a488c00b0077263dd03f3si768604qkb.33.2023.10.03.11.34.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Oct 2023 11:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u9lLVIA4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnkAs-00084m-DA; Tue, 03 Oct 2023 14:31:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnkAp-00082c-6g for qemu-devel@nongnu.org; Tue, 03 Oct 2023 14:31:11 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnkAm-0001fC-Hk for qemu-devel@nongnu.org; Tue, 03 Oct 2023 14:31:09 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c3d6d88231so9724895ad.0 for ; Tue, 03 Oct 2023 11:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696357866; x=1696962666; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HBgYnkG/UUhR0Bh5p/v3uxe98ghyIsuRr/l/CO8AZ6c=; b=u9lLVIA4NclPLI3sHPa5yioF0FdxTGF2iPhDNXAL53dwo+mexG2nqkO6kSbIEuIqjc CfKJvpFighYNMgBvDXLP2mYOOVWeGotg53KLYhAcpOrnJZDXKdvvNejSEOQso12RhT59 8cITiY7JeFVfHX/tl4ovZSUbW8wtV+AmdMBRycGTMsHDKP+h+ayWN7J0lM7lUjTxK4Q9 Pgh6lXOmb8MhQjl3YCAG/gE6hu4gT0L7+LFstOcAPpGIZBp6FUOsevzFQq2XyXol/dJO 09xQYktTilCcO4AzJMpWdqr0EqiSJLdw4PuEc3XVNz3idJGWiLFnhdVNURYftYj0bWq9 W9fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696357866; x=1696962666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HBgYnkG/UUhR0Bh5p/v3uxe98ghyIsuRr/l/CO8AZ6c=; b=Iad87YVqdIJZO4X5CLSJZ9zWPldjR1Su3r+fUK/48TX+eZZ7hbRJPHCaeJ9wYFBx5E /105B3TUbkyL+5V0QSvTaE14ldD0jreY+GrXXwLgGRfechBw6F6C2UEwfYn26NZJw4U+ CMda+tG6d0PjxrN1Mt6EWhP+tEiGQztkRd5+nRpvTd0wPF0rcnQEfHpAstkQG9wLFnKp 3qmhJuudqRIQITv8XC5NQqhLJ5oQcsIezyyzjmsn4Tp6hKQzba31k6v338iauzwXR6n/ mDHiODw0XELveuBU8cA1ZTjYSoVCPjCN9iPCorCMJyaCxVNfwC5S27ek0rAHsOggaHL4 OIFA== X-Gm-Message-State: AOJu0Yz6nDQmuUmGJ4t1tukhu2pTb6LgCtbSfvP/LI7hmZKnimScV73A YHiZIGXM8Z68miEvN7mnnXsWbMHWWGkJxU9BBos= X-Received: by 2002:a17:902:bc4b:b0:1bf:728:745b with SMTP id t11-20020a170902bc4b00b001bf0728745bmr332700plz.49.1696357866237; Tue, 03 Oct 2023 11:31:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id g7-20020a170902934700b001b7cbc5871csm1920432plp.53.2023.10.03.11.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:31:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: fei2.wu@intel.com, "Vanderson M . do Rosario" , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v17 07/16] accel/tcg: Collect TB jit statistics Date: Tue, 3 Oct 2023 11:30:49 -0700 Message-Id: <20231003183058.1639121-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003183058.1639121-1-richard.henderson@linaro.org> References: <20231003183058.1639121-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Collect items like input and output code size, guest instruction count, intermediate ops, spills, etc. Signed-off-by: Vanderson M. do Rosario Signed-off-by: Alex Bennée Signed-off-by: Fei Wu [rth: Consolidated at the end of translation.] Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translate-all.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 6e64ae2dbe..ad4538f169 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -557,6 +557,27 @@ TranslationBlock *tb_gen_code(CPUState *cpu, return tb; } + /* Record JIT statistics, if required. */ + if (unlikely(tb_stats_enabled & TB_STATS_JIT)) { + TBStatistics *s = tb->tb_stats; + if (s) { + s->code.num_tcg_ops += tcg_ctx->orig_nb_ops; + s->code.num_tcg_ops_opt += tcg_ctx->nb_ops; + s->code.temps += tcg_ctx->nb_temps; + s->code.deleted_ops += tcg_ctx->nb_deleted_ops; + s->code.spills += tcg_ctx->nb_spills; + + s->code.num_guest_inst += tb->icount; + s->code.in_len += tb->size; + s->code.out_len += tb->tc.size; + s->code.search_out_len += search_size; + s->translations.total += 1; + if (tb_page_addr1(tb) != -1) { + s->translations.spanning += 1; + } + } + } + /* * Insert TB into the corresponding region tree before publishing it * through QHT. Otherwise rewinding happened in the TB might fail to