public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite
Date: Wed, 13 Nov 2019 09:15:15 -0300	[thread overview]
Message-ID: <20191113121515.GC14646@kernel.org> (raw)
In-Reply-To: <20191113120206.26957-1-adrian.hunter@intel.com>

Em Wed, Nov 13, 2019 at 02:02:06PM +0200, Adrian Hunter escreveu:
> Prior to version 3.23 SQLite does not support TRUE or FALSE, so always use
> 1 and 0 for SQLite.
> 
> Fixes: 26c11206f433 ("perf scripts python: exported-sql-viewer.py: Use new 'has_calls' column")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> Cc: stable@vger.kernel.org

Thanks, applied and added the first tag with that fixed cset:

Cc: stable@vger.kernel.org # v5.3+

[acme@quaco perf]$ git tag --contains 26c11206f433 | grep ^v[3-9] | head
v5.3
v5.3-rc1
v5.3-rc2
v5.3-rc3
v5.3-rc4
v5.3-rc5
v5.3-rc6
v5.3-rc7
v5.3-rc8
v5.4-rc1
[acme@quaco perf]$

- Arnaldo

> ---
>  tools/perf/scripts/python/exported-sql-viewer.py | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
> index ebc6a2e5eae9..26d7be785288 100755
> --- a/tools/perf/scripts/python/exported-sql-viewer.py
> +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> @@ -637,7 +637,7 @@ class CallGraphRootItem(CallGraphLevelItemBase):
>  		self.query_done = True
>  		if_has_calls = ""
>  		if IsSelectable(glb.db, "comms", columns = "has_calls"):
> -			if_has_calls = " WHERE has_calls = TRUE"
> +			if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE
>  		query = QSqlQuery(glb.db)
>  		QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls)
>  		while query.next():
> @@ -918,7 +918,7 @@ class CallTreeRootItem(CallGraphLevelItemBase):
>  		self.query_done = True
>  		if_has_calls = ""
>  		if IsSelectable(glb.db, "comms", columns = "has_calls"):
> -			if_has_calls = " WHERE has_calls = TRUE"
> +			if_has_calls = " WHERE has_calls = " + glb.dbref.TRUE
>  		query = QSqlQuery(glb.db)
>  		QueryExec(query, "SELECT id, comm FROM comms" + if_has_calls)
>  		while query.next():
> @@ -1290,7 +1290,7 @@ class SwitchGraphData(GraphData):
>  		QueryExec(query, "SELECT id, c_time"
>  					" FROM comms"
>  					" WHERE c_thread_id = " + str(thread_id) +
> -					"   AND exec_flag = TRUE"
> +					"   AND exec_flag = " + self.collection.glb.dbref.TRUE +
>  					"   AND c_time >= " + str(start_time) +
>  					"   AND c_time <= " + str(end_time) +
>  					" ORDER BY c_time, id")
> @@ -5016,6 +5016,12 @@ class DBRef():
>  	def __init__(self, is_sqlite3, dbname):
>  		self.is_sqlite3 = is_sqlite3
>  		self.dbname = dbname
> +		self.TRUE = "TRUE"
> +		self.FALSE = "FALSE"
> +		# SQLite prior to version 3.23 does not support TRUE and FALSE
> +		if self.is_sqlite3:
> +			self.TRUE = "1"
> +			self.FALSE = "0"
>  
>  	def Open(self, connection_name):
>  		dbname = self.dbname
> -- 
> 2.17.1

-- 

- Arnaldo

  reply	other threads:[~2019-11-13 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 12:02 [PATCH] perf scripts python: exported-sql-viewer.py: Fix use of TRUE with SQLite Adrian Hunter
2019-11-13 12:15 ` Arnaldo Carvalho de Melo [this message]
2019-11-13 12:28   ` Adrian Hunter
2019-11-13 12:58     ` Arnaldo Carvalho de Melo
2019-11-19 16:56 ` [tip: perf/core] " tip-bot2 for Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191113121515.GC14646@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox