diff --git a/pkg/executor/slow_query_test.go b/pkg/executor/slow_query_test.go index e63f95f0f2cd3..c4a755c5464ab 100644 --- a/pkg/executor/slow_query_test.go +++ b/pkg/executor/slow_query_test.go @@ -147,8 +147,8 @@ func TestParseSlowLogFile(t *testing.T) { # Request_unit_read: 2.158 # Request_unit_write: 2.123 # Time_queued_by_rc: 0.05 -# Tidb_cpu_usage: 0.01 -# Tikv_cpu_usage: 0.021 +# Tidb_cpu_time: 0.01 +# Tikv_cpu_time: 0.021 # Plan_digest: 60e9378c746d9a2be1c791047e008967cf252eb6de9167ad3aa6098fa2d523f4 # Prev_stmt: update t set i = 1; use test; diff --git a/pkg/infoschema/internal/testkit.go b/pkg/infoschema/internal/testkit.go index a8a18875172a9..c68efa9752126 100644 --- a/pkg/infoschema/internal/testkit.go +++ b/pkg/infoschema/internal/testkit.go @@ -98,8 +98,8 @@ select * from t_slim; # Resource_group: rg1 # Request_unit_read: 96.66703066666668 # Request_unit_write: 3182.424414062492 -# Tidb_cpu_usage: 0.01 -# Tikv_cpu_usage: 0.021 +# Tidb_cpu_time: 0.01 +# Tikv_cpu_time: 0.021 INSERT INTO ...; `) require.NoError(t, f.Close()) diff --git a/pkg/infoschema/tables.go b/pkg/infoschema/tables.go index 4520bada6fdb0..f66a3813eef1f 100644 --- a/pkg/infoschema/tables.go +++ b/pkg/infoschema/tables.go @@ -858,8 +858,8 @@ var tableProcesslistCols = []columnInfo{ {name: "RESOURCE_GROUP", tp: mysql.TypeVarchar, size: resourcegroup.MaxGroupNameLength, flag: mysql.NotNullFlag, deflt: ""}, {name: "SESSION_ALIAS", tp: mysql.TypeVarchar, size: 64, flag: mysql.NotNullFlag, deflt: ""}, {name: "ROWS_AFFECTED", tp: mysql.TypeLonglong, size: 21, flag: mysql.UnsignedFlag}, - {name: "TIDB_CPU", tp: mysql.TypeDouble, size: 22, flag: mysql.NotNullFlag, deflt: 0}, - {name: "TIKV_CPU", tp: mysql.TypeDouble, size: 22, flag: mysql.NotNullFlag, deflt: 0}, + {name: "TIDB_CPU", tp: mysql.TypeLonglong, size: 21, flag: mysql.NotNullFlag, deflt: 0}, + {name: "TIKV_CPU", tp: mysql.TypeLonglong, size: 21, flag: mysql.NotNullFlag, deflt: 0}, } var tableTiDBIndexesCols = []columnInfo{ diff --git a/pkg/infoschema/test/clustertablestest/tables_test.go b/pkg/infoschema/test/clustertablestest/tables_test.go index 8576d21fad91f..ac80fac0867fb 100644 --- a/pkg/infoschema/test/clustertablestest/tables_test.go +++ b/pkg/infoschema/test/clustertablestest/tables_test.go @@ -170,8 +170,8 @@ func TestInfoSchemaFieldValue(t *testing.T) { " `RESOURCE_GROUP` varchar(32) NOT NULL DEFAULT '',\n" + " `SESSION_ALIAS` varchar(64) NOT NULL DEFAULT '',\n" + " `ROWS_AFFECTED` bigint(21) unsigned DEFAULT NULL,\n" + - " `TIDB_CPU` double NOT NULL DEFAULT '0',\n" + - " `TIKV_CPU` double NOT NULL DEFAULT '0'\n" + + " `TIDB_CPU` bigint(21) NOT NULL DEFAULT '0',\n" + + " `TIKV_CPU` bigint(21) NOT NULL DEFAULT '0'\n" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin")) tk.MustQuery("show create table information_schema.cluster_log").Check( testkit.Rows("" + diff --git a/pkg/sessionctx/variable/session.go b/pkg/sessionctx/variable/session.go index 31a0db7f794dc..c214de45631be 100644 --- a/pkg/sessionctx/variable/session.go +++ b/pkg/sessionctx/variable/session.go @@ -3331,9 +3331,9 @@ const ( // SlowLogWaitRUDuration is the total duration for kv requests to wait available request-units. SlowLogWaitRUDuration = "Time_queued_by_rc" // SlowLogTidbCPUUsageDuration is the total tidb cpu usages. - SlowLogTidbCPUUsageDuration = "Tidb_cpu_usage" + SlowLogTidbCPUUsageDuration = "Tidb_cpu_time" // SlowLogTikvCPUUsageDuration is the total tikv cpu usages. - SlowLogTikvCPUUsageDuration = "Tikv_cpu_usage" + SlowLogTikvCPUUsageDuration = "Tikv_cpu_time" ) // GenerateBinaryPlan decides whether we should record binary plan in slow log and stmt summary. diff --git a/pkg/util/processinfo.go b/pkg/util/processinfo.go index 357f469c0e045..92559da329ea9 100644 --- a/pkg/util/processinfo.go +++ b/pkg/util/processinfo.go @@ -155,7 +155,7 @@ func (pi *ProcessInfo) ToRow(tz *time.Location) []any { cpuUsages = pi.SQLCPUUsage.GetCPUUsages() } return append(pi.ToRowForShow(true), pi.Digest, bytesConsumed, diskConsumed, - pi.txnStartTs(tz), pi.ResourceGroupName, pi.SessionAlias, affectedRows, cpuUsages.TidbCPUTime.Seconds(), cpuUsages.TikvCPUTime.Seconds()) + pi.txnStartTs(tz), pi.ResourceGroupName, pi.SessionAlias, affectedRows, cpuUsages.TidbCPUTime.Nanoseconds(), cpuUsages.TikvCPUTime.Nanoseconds()) } // ascServerStatus is a slice of all defined server status in ascending order.