1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include "statistics.h" 28 29 static sort_statistics_t *run_stats; 30 31 void 32 stats_init(sort_statistics_t *s) 33 { 34 run_stats = s; 35 memset(s, 0, sizeof (sort_statistics_t)); 36 } 37 38 void 39 stats_display() 40 { 41 (void) fprintf(stderr, 42 "Lines fetched: %20llu\n" 43 "Lines shelved: %20llu\n" 44 "Lines put: %20llu\n" 45 "Lines put uniquely: %20llu\n" 46 "Lines not unique: %20llu\n" 47 "Input files: %20u\n" 48 "Merge files: %20u\n" 49 "Subfiles: %20llu\n" 50 "TQS calls: %20llu\n" 51 "Swaps: %20llu\n" 52 "Available memory: %20llu\n" 53 "Insert filled input:%20llu\n" 54 "Insert filled up: %20llu\n" 55 "Insert filled down: %20llu\n" 56 "TQS calls: %20llu\n" 57 "Convert reallocs: %20llu\n" 58 "Line conversions: %20llu\n", 59 run_stats->st_fetched_lines, 60 run_stats->st_shelved_lines, 61 run_stats->st_put_lines, 62 run_stats->st_put_unique_lines, 63 run_stats->st_not_unique_lines, 64 run_stats->st_input_files, 65 run_stats->st_merge_files, 66 run_stats->st_subfiles, 67 run_stats->st_tqs_calls, 68 run_stats->st_swaps, 69 run_stats->st_avail_mem, 70 run_stats->st_insert_full_input, 71 run_stats->st_insert_full_up, 72 run_stats->st_insert_full_down, 73 run_stats->st_tqs_calls, 74 run_stats->st_convert_reallocs, 75 run_stats->st_line_conversions); 76 } 77 78 void 79 stats_incr_subfiles() 80 { 81 run_stats->st_subfiles++; 82 } 83 84 void 85 stats_incr_fetches() 86 { 87 run_stats->st_fetched_lines++; 88 } 89 90 void 91 stats_incr_shelves() 92 { 93 run_stats->st_shelved_lines++; 94 } 95 96 void 97 stats_incr_puts() 98 { 99 run_stats->st_put_lines++; 100 } 101 102 void 103 stats_incr_swaps() 104 { 105 run_stats->st_swaps++; 106 } 107 108 void 109 stats_set_input_files(uint_t n) 110 { 111 run_stats->st_input_files = n; 112 } 113 114 void 115 stats_incr_input_files() 116 { 117 run_stats->st_input_files++; 118 } 119 120 void 121 stats_set_merge_files(uint_t n) 122 { 123 run_stats->st_merge_files = n; 124 } 125 126 void 127 stats_incr_merge_files() 128 { 129 run_stats->st_merge_files++; 130 } 131 132 void 133 stats_set_available_memory(uint64_t a) 134 { 135 run_stats->st_avail_mem = a; 136 } 137 138 void 139 stats_incr_insert_filled_input() 140 { 141 run_stats->st_insert_full_input++; 142 } 143 144 void 145 stats_incr_insert_filled_upward() 146 { 147 run_stats->st_insert_full_up++; 148 } 149 150 void 151 stats_incr_insert_filled_downward() 152 { 153 run_stats->st_insert_full_down++; 154 } 155 156 void 157 stats_incr_tqs_calls() 158 { 159 run_stats->st_tqs_calls++; 160 } 161 162 void 163 stats_incr_put_unique() 164 { 165 run_stats->st_put_unique_lines++; 166 } 167 168 void 169 stats_incr_not_unique() 170 { 171 run_stats->st_not_unique_lines++; 172 } 173 174 void 175 stats_incr_convert_reallocs() 176 { 177 run_stats->st_convert_reallocs++; 178 } 179 180 void 181 stats_incr_line_conversions() 182 { 183 run_stats->st_line_conversions++; 184 } 185