1dcbf3bd6SGeorge Wilson /* 2dcbf3bd6SGeorge Wilson * This file and its contents are supplied under the terms of the 3dcbf3bd6SGeorge Wilson * Common Development and Distribution License ("CDDL"), version 1.0. 4dcbf3bd6SGeorge Wilson * You may only use this file in accordance with the terms of version 5dcbf3bd6SGeorge Wilson * 1.0 of the CDDL. 6dcbf3bd6SGeorge Wilson * 7dcbf3bd6SGeorge Wilson * A full copy of the text of the CDDL should have accompanied this 8dcbf3bd6SGeorge Wilson * source. A copy of the CDDL is also available via the Internet at 9dcbf3bd6SGeorge Wilson * http://www.illumos.org/license/CDDL. 10dcbf3bd6SGeorge Wilson */ 11dcbf3bd6SGeorge Wilson 12dcbf3bd6SGeorge Wilson /* 13479ad5c2SJohn Wren Kennedy * Copyright (c) 2015, 2016 by Delphix. All rights reserved. 14dcbf3bd6SGeorge Wilson */ 15dcbf3bd6SGeorge Wilson 16dcbf3bd6SGeorge Wilson /* 17dcbf3bd6SGeorge Wilson * prefetch_ios: Number of IOs the prefetcher issued 18479ad5c2SJohn Wren Kennedy * @c["prefetched_demand_reads"]: Number of demand reads already prefetched 19479ad5c2SJohn Wren Kennedy * @c["sync_wait_for_async"]: Number of times sync IO waited for prefetch IO 20479ad5c2SJohn Wren Kennedy * @s["demand"]: Number of non-prefetch read IOs 21479ad5c2SJohn Wren Kennedy * @s["logical"]: Logical (uncompressed) bytes read per interval 22479ad5c2SJohn Wren Kennedy * @s["physical"]: Physical (compressed) bytes read per interval 23dcbf3bd6SGeorge Wilson */ 24dcbf3bd6SGeorge Wilson 25dcbf3bd6SGeorge Wilson #pragma D option aggsortkey 26dcbf3bd6SGeorge Wilson #pragma D option quiet 27dcbf3bd6SGeorge Wilson 28dcbf3bd6SGeorge Wilson #define SPA_MINBLOCKSHIFT 9 29dcbf3bd6SGeorge Wilson #define ARC_FLAGS_PREFETCH (1 << 3) 30dcbf3bd6SGeorge Wilson #define HDR_GET_LSIZE(hdr) ((hdr)->b_lsize << SPA_MINBLOCKSHIFT) 31dcbf3bd6SGeorge Wilson #define HDR_GET_PSIZE(hdr) ((hdr)->b_psize << SPA_MINBLOCKSHIFT) 32dcbf3bd6SGeorge Wilson 33dcbf3bd6SGeorge Wilson BEGIN 34dcbf3bd6SGeorge Wilson { 35dcbf3bd6SGeorge Wilson prefetch_ios = `arc_stats.arcstat_prefetch_data_misses.value.ui64; 36dcbf3bd6SGeorge Wilson prefetch_ios += `arc_stats.arcstat_prefetch_metadata_misses.value.ui64; 37479ad5c2SJohn Wren Kennedy @s["demand"] = sum(0); 38479ad5c2SJohn Wren Kennedy @s["logical"] = sum(0); 39479ad5c2SJohn Wren Kennedy @s["physical"] = sum(0); 40479ad5c2SJohn Wren Kennedy @c["prefetched_demand_reads"] = count(); 41479ad5c2SJohn Wren Kennedy @c["sync_wait_for_async"] = count(); 42479ad5c2SJohn Wren Kennedy clear(@s); 43479ad5c2SJohn Wren Kennedy clear(@c); 44dcbf3bd6SGeorge Wilson } 45dcbf3bd6SGeorge Wilson 46dcbf3bd6SGeorge Wilson arc_read:arc-demand-hit-predictive-prefetch 47dcbf3bd6SGeorge Wilson { 48479ad5c2SJohn Wren Kennedy @c["prefetched_demand_reads"] = count(); 49dcbf3bd6SGeorge Wilson } 50dcbf3bd6SGeorge Wilson 51*a3874b8bSToomas Soome arc_read:arc-upgrade-sync 52dcbf3bd6SGeorge Wilson { 53*a3874b8bSToomas Soome @c["async_upgrade_sync"] = count(); 54dcbf3bd6SGeorge Wilson } 55dcbf3bd6SGeorge Wilson 56dcbf3bd6SGeorge Wilson arc_read_done:entry 57dcbf3bd6SGeorge Wilson / args[0]->io_spa->spa_name == $$1 / 58dcbf3bd6SGeorge Wilson { 59dcbf3bd6SGeorge Wilson this->zio = args[0]; 60479ad5c2SJohn Wren Kennedy this->hdr = (arc_buf_hdr_t *)this->zio->io_private; 61479ad5c2SJohn Wren Kennedy @s["demand"] = sum(this->hdr->b_flags & ARC_FLAGS_PREFETCH ? 0 : 1); 62479ad5c2SJohn Wren Kennedy @s["logical"] = sum(HDR_GET_LSIZE(this->hdr)); 63479ad5c2SJohn Wren Kennedy @s["physical"] = sum(HDR_GET_PSIZE(this->hdr)); 64dcbf3bd6SGeorge Wilson } 65dcbf3bd6SGeorge Wilson 66dcbf3bd6SGeorge Wilson tick-$2s 67dcbf3bd6SGeorge Wilson { 68dcbf3bd6SGeorge Wilson this->new_prefetch_ios = 69dcbf3bd6SGeorge Wilson `arc_stats.arcstat_prefetch_data_misses.value.ui64 + 70dcbf3bd6SGeorge Wilson `arc_stats.arcstat_prefetch_metadata_misses.value.ui64; 71dcbf3bd6SGeorge Wilson printf("%u\n%-24s\t%u\n", `time, "prefetch_ios", 72dcbf3bd6SGeorge Wilson this->new_prefetch_ios - prefetch_ios); 73479ad5c2SJohn Wren Kennedy printa("%-24s\t%@u\n", @s); 74479ad5c2SJohn Wren Kennedy printa("%-24s\t%@u\n", @c); 75dcbf3bd6SGeorge Wilson prefetch_ios = this->new_prefetch_ios; 76479ad5c2SJohn Wren Kennedy clear(@s); 77479ad5c2SJohn Wren Kennedy clear(@c); 78dcbf3bd6SGeorge Wilson } 79dcbf3bd6SGeorge Wilson 80dcbf3bd6SGeorge Wilson ERROR 81dcbf3bd6SGeorge Wilson { 82dcbf3bd6SGeorge Wilson trace(arg1); 83dcbf3bd6SGeorge Wilson trace(arg2); 84dcbf3bd6SGeorge Wilson trace(arg3); 85dcbf3bd6SGeorge Wilson trace(arg4); 86dcbf3bd6SGeorge Wilson trace(arg5); 87dcbf3bd6SGeorge Wilson } 88