getUserHardwareUsage

Syntax

getUserHardwareUsage([from=0], [to])

Arguments

from (optional) is an integral or temporal number indicating the start time of the query. The default value is 0, indicating the queried records starts from the record at 1970.01.01 00:00.

to (optional) is an integral or temporal number indicating the end time of the query. The default value is NULL, indicating the query includes records up to the current time.

Note that from must be no greater than to.

Details

Get the CPU and memory usage within the specified time range from query logs (located at <HomeDir>/resource/hardware.log). This function can only be called by the administrator on a data node.

It returns a table containing the following columns:

  • timestamp: a timestamp of NANOTIMESTAMP type.

  • userId: the login user ID.

  • cpu: the number of CPU threads used by the user.

  • memory: the memory used (in bytes) by the user.

Examples

getUserHardwareUsage(2023.12.29T10:55:43.280031346,2023.12.29T10:56:23.321355134)
// output
timestamp	userId	cpu	memory
2023.12.29T10:55:43.280031346	guest	1	16
2023.12.29T10:55:53.290361530	admin	0	16
2023.12.29T10:55:53.290361530	guest	1	16
2023.12.29T10:56:03.299225976	admin	0	16
2023.12.29T10:56:03.299225976	guest	1	16
2023.12.29T10:56:13.310316778	admin	0	16
2023.12.29T10:56:13.310316778	guest	1	16