Gem5のシミュレーションにより生成されるログファイルについて確認する。
シミュレーション終了後に、m5out
ディレクトリに情報が出力される。
config.ini
: シミュレーション向けに生成されたすべてのSimObjectのリストが、パラメータの値とともに格納されている。config.json
:config.ini
と同じ情報がJSONフォーマットで格納されている。stats.txt
: Gem5シミュレーションの全ての統計情報がテキスト形式で格納されている。
まずは、 m5out/config.ini
を見てみる。長いので、まずはヘッダの部分だけを見てみよう。
grep "^\[" m5out/config.ini [root] [system] [system.clk_domain] [system.clk_domain.voltage_domain] [system.cpu] [system.cpu.decoder] [system.cpu.interrupts] [system.cpu.isa] [system.cpu.mmu] [system.cpu.mmu.dtb] [system.cpu.mmu.dtb.walker] [system.cpu.mmu.dtb.walker.power_state] [system.cpu.mmu.itb] [system.cpu.mmu.itb.walker] [system.cpu.mmu.itb.walker.power_state] [system.cpu.mmu.pma_checker] [system.cpu.mmu.pmp] [system.cpu.power_state] [system.cpu.tracer] [system.cpu.workload] [system.dvfs_handler] [system.mem_ctrl] [system.mem_ctrl.dram] [system.mem_ctrl.dram.power_state] [system.mem_ctrl.power_state] [system.membus] [system.membus.power_state] [system.membus.snoop_filter] [system.workload]
これらの情報は、シミュレーションが正しいコンフィグレーションで実行できたかどうかを保証するために非常に重要だ。
[system.membus] type=CoherentXBar children=power_state snoop_filter clk_domain=system.clk_domain eventq_index=0 forward_latency=4 frontend_latency=3 header_latency=1 max_outstanding_snoops=512 max_routing_table_size=512 point_of_coherency=true point_of_unification=true power_model= power_state=system.membus.power_state response_latency=2 snoop_filter=system.membus.snoop_filter snoop_response_latency=4 system=system use_default_range=false width=16 cpu_side_ports=system.cpu.icache_port system.cpu.dcache_port system.system_port mem_side_ports=system.mem_ctrl.port
次に、stats.txt
について。Gem5がカバーする統計情報は、Gem5 Wikiに書いてある(そうなのだが、そのリンクは切れていた:https://www.gem5.org/Statistics → http://old.gem5.org/Statistics.html)。
各SimObjectは独自の統計情報を含んでいるので、シミュレーションの終了後に、統計情報をダンプするためのコマンドが発行され、SimObjectがファイルに対してダンプを行う。
---------- Begin Simulation Statistics ---------- simSeconds 0.000171 # Number of seconds simulated (Second) simTicks 171176000 # Number of ticks simulated (Tick) finalTick 171176000 # Number of ticks from beginning of simulation (restored from checkpoints and never reset) (Tick) simFreq 1000000000000 # The number of ticks per simulated second ((Tick/Second)) hostSeconds 0.00 # Real time elapsed on the host (Second) hostTickRate 35332697173 # The number of ticks simulated per host second (ticks/s) ((Tick/Second)) hostMemory 602108 # Number of bytes of host memory used (Byte) simInsts 2259 # Number of instructions simulated (Count) simOps 2259 # Number of ops (including micro ops) simulated (Count) hostInstRate 460202 # Simulator instruction rate (inst/s) ((Count/Second)) hostOpRate 459722 # Simulator op (including micro ops) rate (op/s) ((Count/Second)) system.clk_domain.clock 1000 # Clock period in ticks (Tick) system.clk_domain.voltage_domain.voltage 1 # Voltage in Volts (Volt) system.cpu.numCycles 171176 # Number of cpu cycles simulated (Cycle) system.cpu.numWorkItemsStarted 0 # Number of work items this cpu started (Count) system.cpu.numWorkItemsCompleted 0 # Number of work items this cpu completed (Count) system.cpu.exec_context.thread_0.numInsts 2259 # Number of instructions committed (Count) system.cpu.exec_context.thread_0.numOps 2259 # Number of ops (including micro ops) committed (Count) system.cpu.exec_context.thread_0.numIntAluAccesses 2224 # Number of integer alu accesses (Count) system.cpu.exec_context.thread_0.numFpAluAccesses 0 # Number of float alu accesses (Count) system.cpu.exec_context.thread_0.numVecAluAccesses 0 # Number of vector alu accesses (Count) ...
まず、---------- Begin Simulation Statistics ----------
によって統計情報のダンプが始まる。
これはプログラムの実行情報や、シミュレーションの実行時間・実行サイクルなどの情報を含んでいる。
その次に、SimObjectsの統計情報が出力される。 例えば、SimObjectsによてシステムコールが呼ばれる回数などが出力される。
関連記事: