通过 analytics datasets 上下文,可以管理数据集。
使用 show 命令可列出数据集:
caji:analytics datasets> show Datasets: DATASET STATE INCORE ONDISK NAME dataset-000 active 674K 35.7K arc.accesses[hit/miss] dataset-001 active 227K 31.1K arc.l2_accesses[hit/miss] dataset-002 active 227K 31.1K arc.l2_size dataset-003 active 227K 31.1K arc.size dataset-004 active 806K 35.7K arc.size[component] dataset-005 active 227K 31.1K cpu.utilization dataset-006 active 451K 35.6K cpu.utilization[mode] dataset-007 active 57.7K 0 dnlc.accesses dataset-008 active 490K 35.6K dnlc.accesses[hit/miss] dataset-009 active 227K 31.1K http.reqs dataset-010 active 227K 31.1K io.bytes dataset-011 active 268K 31.1K io.bytes[op] dataset-012 active 227K 31.1K io.ops ...
上述数据集多数都默认归档,只有一个数据集例外:"dataset-007",此数据集没有 ONDISK 大小,表示它是未进行归档的临时统计信息。此处统计信息的名称是 BUI 中所显示内容的缩写版本:"dnlc.accesses" 是 "Cache: DNLC accesses per second" 的缩写。
选择特定的数据集后,可以查看其属性:
caji:analytics datasets> select dataset-007 caji:analytics dataset-007> show Properties: name = dnlc.accesses grouping = Cache explanation = DNLC accesses per second incore = 65.5K size = 0 suspended = false
使用 read 命令可以读取数据集统计信息(几秒钟后才会显示):
caji:analytics datasets> select dataset-007 caji:analytics dataset-007> read 10 DATE/TIME /SEC /SEC BREAKDOWN 2009-10-14 21:25:19 137 - - 2009-10-14 21:25:20 215 - - 2009-10-14 21:25:21 156 - - 2009-10-14 21:25:22 171 - - 2009-10-14 21:25:23 2722 - - 2009-10-14 21:25:24 190 - - 2009-10-14 21:25:25 156 - - 2009-10-14 21:25:26 166 - - 2009-10-14 21:25:27 118 - - 2009-10-14 21:25:28 1354 - -
同时也会列出细目(如果有)。下方显示了 dataset-006 按 CPU 模式(用户/内核)细分的 CPU 利用率:
caji:analytics datasets> select dataset-006 caji:analytics dataset-006> read 5 DATE/TIME %UTIL %UTIL BREAKDOWN 2009-10-14 21:30:07 7 6 kernel 0 user 2009-10-14 21:30:08 7 7 kernel 0 user 2009-10-14 21:30:09 0 - - 2009-10-14 21:30:10 15 14 kernel 1 user 2009-10-14 21:30:11 25 24 kernel 1 user
摘要显示在 "%UTIL" 中,贡献元素显示在 "%UTIL BREAKDOWN" 中。在 21:30:10,内核占用 14%,用户占用 1%。21:30:09 行显示 "%UTIL" 摘要为 0%,因此没有列出明细 ("--")。
要对数秒内的数据打印逗号分隔值 (comma separated value, CSV) 文件,请使用 csv 命令:
knife:analytics datasets> select dataset-022 knife:analytics dataset-022> csv 10 Time (UTC),Operations per second 2011-03-21 18:30:02,0 2011-03-21 18:30:03,0 2011-03-21 18:30:04,0 2011-03-21 18:30:05,0 2011-03-21 18:30:06,0 2011-03-21 18:30:07,0 2011-03-21 18:30:08,0 2011-03-21 18:30:09,0 2011-03-21 18:30:10,0 2011-03-21 18:30:11,0
CLI 具有一项 BUI 中尚不具备的功能:暂停和恢复所有数据集。当对设备进行基准测试以确定其绝对最高性能时,此功能可能会很有用。由于对某些统计信息进行归档可能会占用大量的 CPU 和磁盘资源,因此在启用这些统计信息时执行的基准测试无效。
要暂停所有数据集,请使用 suspend:
caji:analytics datasets> suspend This will suspend all datasets. Are you sure? (Y/N) y caji:analytics datasets> show Datasets: DATASET STATE INCORE ONDISK NAME dataset-000 suspend 638K 584K arc.accesses[hit/miss] dataset-001 suspend 211K 172K arc.l2_accesses[hit/miss] dataset-002 suspend 211K 133K arc.l2_size dataset-003 suspend 211K 133K arc.size ...
要恢复所有数据集,请使用 resume:
caji:analytics datasets> resume caji:analytics datasets> show Datasets: DATASET STATE INCORE ONDISK NAME dataset-000 active 642K 588K arc.accesses[hit/miss] dataset-001 active 215K 174K arc.l2_accesses[hit/miss] dataset-002 active 215K 134K arc.l2_size dataset-003 active 215K 134K arc.size ...
要放弃数据集中分钟级别的数据粒度,请使用 prune 命令:
caji:analytics dataset-001> prune minute This will remove per-second and minute data collected prior to 2012-4-02 16:56:52.
Are you sure? (Y/N)
注意:此命令也会删除更低级别的数据粒度。例如,使用 prune hour 命令时也会删除秒级别和分钟级别的数据。