dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sort / common / statistics.c
blob3121956d169c20c598805bd5a7d0db53855e44dd
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "statistics.h"
31 static sort_statistics_t *run_stats;
33 void
34 stats_init(sort_statistics_t *s)
36 run_stats = s;
37 memset(s, 0, sizeof (sort_statistics_t));
40 void
41 stats_display()
43 (void) fprintf(stderr,
44 "Lines fetched: %20llu\n"
45 "Lines shelved: %20llu\n"
46 "Lines put: %20llu\n"
47 "Lines put uniquely: %20llu\n"
48 "Lines not unique: %20llu\n"
49 "Input files: %20u\n"
50 "Merge files: %20u\n"
51 "Subfiles: %20llu\n"
52 "TQS calls: %20llu\n"
53 "Swaps: %20llu\n"
54 "Available memory: %20llu\n"
55 "Insert filled input:%20llu\n"
56 "Insert filled up: %20llu\n"
57 "Insert filled down: %20llu\n"
58 "TQS calls: %20llu\n"
59 "Convert reallocs: %20llu\n"
60 "Line conversions: %20llu\n",
61 run_stats->st_fetched_lines,
62 run_stats->st_shelved_lines,
63 run_stats->st_put_lines,
64 run_stats->st_put_unique_lines,
65 run_stats->st_not_unique_lines,
66 run_stats->st_input_files,
67 run_stats->st_merge_files,
68 run_stats->st_subfiles,
69 run_stats->st_tqs_calls,
70 run_stats->st_swaps,
71 run_stats->st_avail_mem,
72 run_stats->st_insert_full_input,
73 run_stats->st_insert_full_up,
74 run_stats->st_insert_full_down,
75 run_stats->st_tqs_calls,
76 run_stats->st_convert_reallocs,
77 run_stats->st_line_conversions);
80 void
81 stats_incr_subfiles()
83 run_stats->st_subfiles++;
86 void
87 stats_incr_fetches()
89 run_stats->st_fetched_lines++;
92 void
93 stats_incr_shelves()
95 run_stats->st_shelved_lines++;
98 void
99 stats_incr_puts()
101 run_stats->st_put_lines++;
104 void
105 stats_incr_swaps()
107 run_stats->st_swaps++;
110 void
111 stats_set_input_files(uint_t n)
113 run_stats->st_input_files = n;
116 void
117 stats_incr_input_files()
119 run_stats->st_input_files++;
122 void
123 stats_set_merge_files(uint_t n)
125 run_stats->st_merge_files = n;
128 void
129 stats_incr_merge_files()
131 run_stats->st_merge_files++;
134 void
135 stats_set_available_memory(uint64_t a)
137 run_stats->st_avail_mem = a;
140 void
141 stats_incr_insert_filled_input()
143 run_stats->st_insert_full_input++;
146 void
147 stats_incr_insert_filled_upward()
149 run_stats->st_insert_full_up++;
152 void
153 stats_incr_insert_filled_downward()
155 run_stats->st_insert_full_down++;
158 void
159 stats_incr_tqs_calls()
161 run_stats->st_tqs_calls++;
164 void
165 stats_incr_put_unique()
167 run_stats->st_put_unique_lines++;
170 void
171 stats_incr_not_unique()
173 run_stats->st_not_unique_lines++;
176 void
177 stats_incr_convert_reallocs()
179 run_stats->st_convert_reallocs++;
182 void
183 stats_incr_line_conversions()
185 run_stats->st_line_conversions++;