From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B3F5C47404 for ; Wed, 9 Oct 2019 18:04:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2008C20679 for ; Wed, 9 Oct 2019 18:04:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2008C20679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIGJv-0006O2-42 for qemu-devel@archiver.kernel.org; Wed, 09 Oct 2019 14:04:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iI8Vz-0005sE-MN for qemu-devel@nongnu.org; Wed, 09 Oct 2019 05:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iI8Vx-0005ER-1z for qemu-devel@nongnu.org; Wed, 09 Oct 2019 05:44:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iI8Vw-0005EL-Px for qemu-devel@nongnu.org; Wed, 09 Oct 2019 05:44:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D68AFC002966; Wed, 9 Oct 2019 09:44:11 +0000 (UTC) Received: from work-vm (ovpn-117-215.ams2.redhat.com [10.36.117.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2EB1C5D6B0; Wed, 9 Oct 2019 09:44:10 +0000 (UTC) Date: Wed, 9 Oct 2019 10:44:07 +0100 From: "Dr. David Alan Gilbert" To: Alex =?iso-8859-1?Q?Benn=E9e?= Subject: Re: [PATCH v9 09/13] Adding info [tb-list|tb] commands to HMP (WIP) Message-ID: <20191009094407.GF2893@work-vm> References: <20191007152839.30804-1-alex.bennee@linaro.org> <20191007152839.30804-10-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20191007152839.30804-10-alex.bennee@linaro.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 09 Oct 2019 09:44:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Vanderson M. do Rosario" , qemu-devel@nongnu.org, Markus Armbruster , cota@braap.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" * Alex Benn=E9e (alex.bennee@linaro.org) wrote: > From: "Vanderson M. do Rosario" >=20 > These commands allow the exploration of TBs generated by the TCG. > Understand which one hotter, with more guest/host instructions... and > examine their guest, host and IR code. >=20 > The goal of this command is to allow the dynamic exploration of TCG > behavior and code quality. Therefore, for now, a corresponding QMP > command is not worthwhile. >=20 > [AJB: WIP - we still can't be safely sure a translation will succeed] >=20 > diff --git a/util/log.c b/util/log.c > index 86bd691967..fa78e2bca9 100644 > --- a/util/log.c > +++ b/util/log.c > @@ -33,25 +33,55 @@ int qemu_loglevel; > static int log_append =3D 0; > static GArray *debug_regions; > int32_t max_num_hot_tbs_to_dump; > +static bool to_monitor; > +bool to_string; > =20 > -/* Return the number of characters emitted. */ > -int qemu_log(const char *fmt, ...) > +GString *string; > + > +int qemu_vlog(const char *fmt, va_list va) > { > int ret =3D 0; > - if (qemu_logfile) { > - va_list ap; > - va_start(ap, fmt); > - ret =3D vfprintf(qemu_logfile, fmt, ap); > - va_end(ap); > - > - /* Don't pass back error results. */ > - if (ret < 0) { > - ret =3D 0; > + if (to_string) { > + if (string) { > + g_string_append_vprintf(string, fmt, va); > } > + } else if (to_monitor) { > + ret =3D qemu_vprintf(fmt, va); > + } else if (qemu_logfile) { > + ret =3D vfprintf(qemu_logfile, fmt, va); > + } > + > + /* Don't pass back error results. */ > + if (ret < 0) { > + ret =3D 0; > } > return ret; > } > =20 > +/* Return the number of characters emitted. */ > +int qemu_log(const char *fmt, ...) > +{ > + int ret =3D 0; > + va_list ap; > + va_start(ap, fmt); > + > + ret =3D qemu_vlog(fmt, ap); > + > + va_end(ap); > + return ret; > +} > + > +void qemu_log_to_monitor(bool enable) > +{ > + to_monitor =3D enable; > +} > + > +void qemu_log_to_string(bool enable, GString *s) > +{ > + to_string =3D enable; > + string =3D s; > +} > + > static bool log_uses_own_buffers; These feel like they should be in a separate patch. Dave > =20 > /* enable or disable low levels log */ > @@ -300,6 +330,7 @@ int qemu_str_to_log_mask(const char *str) > trace_enable_events((*tmp) + 6); > mask |=3D LOG_TRACE; > #endif > +#ifdef CONFIG_TCG > } else if (g_str_has_prefix(*tmp, "tb_stats")) { > mask |=3D CPU_LOG_TB_STATS; > set_default_tbstats_flag(TB_JIT_STATS | TB_EXEC_STATS | TB= _JIT_TIME); > @@ -329,6 +360,7 @@ int qemu_str_to_log_mask(const char *str) > } > set_default_tbstats_flag(flags); > } > +#endif > } else { > for (item =3D qemu_log_items; item->mask !=3D 0; item++) { > if (g_str_equal(*tmp, item->name)) { > --=20 > 2.20.1 >=20 -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK