4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
33 #include "isns_server.h"
34 #include "isns_cache.h"
38 #ifndef TARGET_DATA_STORE
39 #define TARGET_DATA_STORE xml
42 #define TARGET_src(TARGET) XTARGET_src(TARGET)
43 #define XTARGET_src(TARGET) XXTARGET_src(TARGET/data.c)
44 #define XXTARGET_src(TARGET) #TARGET
46 #include TARGET_src(TARGET_DATA_STORE)
48 #define TARGET_func(func) XTARGET_func(TARGET_DATA_STORE, func)
49 #define XTARGET_func(TARGET, func) XXTARGET_func(TARGET, func)
50 #define XXTARGET_func(TARGET, func) TARGET ## func
53 static time_t total_time
= 0;
54 static clock_t total_clock
= 0;
55 extern int verbose_tc
;
62 return (TARGET_func(_init_data
)());
72 return (TARGET_func(_load_obj
)(p
, objp
, phase
));
84 if (verbose_tc
!= 0) {
89 status
= TARGET_func(_add_obj
)(obj
);
91 if (verbose_tc
!= 0) {
96 printf("time %d clock %.4lf -adding one object\n",
97 t
, c
/ (double)CLOCKS_PER_SEC
);
105 const isns_obj_t
*obj
112 if (verbose_tc
!= 0) {
117 status
= TARGET_func(_modify_obj
)(obj
);
119 if (verbose_tc
!= 0) {
124 printf("time %d clock %.4lf -updating one object\n",
125 t
, c
/ (double)CLOCKS_PER_SEC
);
133 const isns_obj_t
*obj
140 if (verbose_tc
!= 0) {
145 status
= TARGET_func(_delete_obj
)(obj
);
147 if (verbose_tc
!= 0) {
152 printf("time %d clock %.4lf -deleting one object\n",
153 t
, c
/ (double)CLOCKS_PER_SEC
);
161 const isns_obj_t
*obj
168 if (verbose_tc
!= 0) {
173 status
= TARGET_func(_delete_assoc
)(obj
);
175 if (verbose_tc
!= 0) {
180 printf("time %d clock %.4lf -deleting one membership\n",
181 t
, c
/ (double)CLOCKS_PER_SEC
);
188 target_update_commit(
195 if (verbose_tc
!= 0) {
200 status
= TARGET_func(_update_commit
)();
202 if (verbose_tc
!= 0) {
207 printf("time %d clock %.4lf -flushing the data\n",
208 t
, c
/ (double)CLOCKS_PER_SEC
);
209 printf("time %d clock %.4lf -total update\n",
210 total_time
, total_clock
/ (double)CLOCKS_PER_SEC
);
219 target_update_retreat(
226 if (verbose_tc
!= 0) {
231 status
= TARGET_func(_update_retreat
)();
233 if (verbose_tc
!= 0) {
238 printf("time %d clock %.4lf -flushing the data\n",
239 t
, c
/ (double)CLOCKS_PER_SEC
);
240 printf("time %d clock %.4lf -total update\n",
241 total_time
, total_clock
/ (double)CLOCKS_PER_SEC
);