Print this page
DLPX-43064 include high-resolution round-trip times in connstat (EP-652)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/time.h
+++ new/usr/src/uts/common/sys/time.h
1 1 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
2 2 /* All Rights Reserved */
3 3
4 4
5 5 /*
6 6 * Copyright (c) 1982, 1986, 1993 Regents of the University of California.
7 7 * All rights reserved. The Berkeley software License Agreement
8 8 * specifies the terms and conditions for redistribution.
9 9 */
10 10
11 11 /*
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
13 13 *
14 14 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
15 15 * Use is subject to license terms.
16 16 *
17 17 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
18 18 * Copyright 2016 Joyent, Inc.
19 19 */
20 20
21 21 /*
22 - * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
22 + * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
23 23 */
24 24
25 25 #ifndef _SYS_TIME_H
26 26 #define _SYS_TIME_H
27 27
28 28 #include <sys/feature_tests.h>
29 29
30 30 /*
31 31 * Structure returned by gettimeofday(2) system call,
32 32 * and used in other calls.
33 33 */
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
40 40 defined(__EXTENSIONS__)
41 41 #ifndef _ASM
42 42
43 43 #if !defined(_TIME_T) || __cplusplus >= 199711L
44 44 #define _TIME_T
45 45 typedef long time_t; /* time of day in seconds */
46 46 #endif /* _TIME_T */
47 47
48 48 #ifndef _SUSECONDS_T
49 49 #define _SUSECONDS_T
50 50 typedef long suseconds_t; /* signed # of microseconds */
51 51 #endif /* _SUSECONDS_T */
52 52
53 53 struct timeval {
54 54 time_t tv_sec; /* seconds */
55 55 suseconds_t tv_usec; /* and microseconds */
56 56 };
57 57
58 58 #if defined(_SYSCALL32)
59 59
60 60 #include <sys/types32.h>
61 61
62 62 #define TIMEVAL32_TO_TIMEVAL(tv, tv32) { \
63 63 (tv)->tv_sec = (time_t)(tv32)->tv_sec; \
64 64 (tv)->tv_usec = (tv32)->tv_usec; \
65 65 }
66 66
67 67 #define TIMEVAL_TO_TIMEVAL32(tv32, tv) { \
68 68 (tv32)->tv_sec = (time32_t)(tv)->tv_sec; \
69 69 (tv32)->tv_usec = (int32_t)(tv)->tv_usec; \
70 70 }
71 71
72 72 #define TIME32_MAX INT32_MAX
73 73 #define TIME32_MIN INT32_MIN
74 74
75 75 #define TIMEVAL_OVERFLOW(tv) \
76 76 ((tv)->tv_sec < TIME32_MIN || (tv)->tv_sec > TIME32_MAX)
77 77
78 78 #endif /* _SYSCALL32 */
79 79
80 80 #endif /* _ASM */
81 81 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
82 82
83 83 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
84 84 #ifndef _ASM
85 85 struct timezone {
86 86 int tz_minuteswest; /* minutes west of Greenwich */
87 87 int tz_dsttime; /* type of dst correction */
88 88 };
89 89
90 90 #endif /* _ASM */
91 91 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
92 92
93 93 #ifdef __cplusplus
94 94 }
95 95 #endif
96 96
97 97 /*
98 98 * Needed for longlong_t type. Placement of this due to <sys/types.h>
99 99 * including <sys/select.h> which relies on the presense of the itimerval
100 100 * structure.
101 101 */
102 102 #ifndef _ASM
103 103 #include <sys/types.h>
104 104 #endif /* _ASM */
105 105
106 106 #ifdef __cplusplus
107 107 extern "C" {
108 108 #endif
109 109
110 110 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
111 111
112 112 #define DST_NONE 0 /* not on dst */
113 113 #define DST_USA 1 /* USA style dst */
114 114 #define DST_AUST 2 /* Australian style dst */
115 115 #define DST_WET 3 /* Western European dst */
116 116 #define DST_MET 4 /* Middle European dst */
117 117 #define DST_EET 5 /* Eastern European dst */
118 118 #define DST_CAN 6 /* Canada */
119 119 #define DST_GB 7 /* Great Britain and Eire */
120 120 #define DST_RUM 8 /* Rumania */
121 121 #define DST_TUR 9 /* Turkey */
122 122 #define DST_AUSTALT 10 /* Australian style with shift in 1986 */
123 123
124 124 /*
125 125 * Operations on timevals.
126 126 */
127 127 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
128 128 #define timercmp(tvp, uvp, cmp) \
129 129 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
130 130 /* CSTYLED */ \
131 131 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
132 132 /* CSTYLED */ \
133 133 ((tvp)->tv_sec cmp (uvp)->tv_sec))
134 134
135 135 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
136 136
137 137 #ifdef __lint
138 138 /*
139 139 * Make innocuous, lint-happy versions until do {} while (0) is acknowleged as
140 140 * lint-safe. If the compiler could know that we always make tv_usec < 1000000
141 141 * we wouldn't need a special linted version.
142 142 */
143 143 #define timeradd(tvp, uvp, vvp) \
144 144 do \
145 145 { \
146 146 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
147 147 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
148 148 if ((vvp)->tv_usec >= 1000000) \
149 149 { \
150 150 (vvp)->tv_sec++; \
151 151 (vvp)->tv_usec -= 1000000; \
152 152 } \
153 153 } while ((vvp)->tv_usec >= 1000000)
154 154 #define timersub(tvp, uvp, vvp) \
155 155 do \
156 156 { \
157 157 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
158 158 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
159 159 if ((vvp)->tv_usec < 0) \
160 160 { \
161 161 (vvp)->tv_sec--; \
162 162 (vvp)->tv_usec += 1000000; \
163 163 } \
164 164 } while ((vvp)->tv_usec >= 1000000)
165 165 #else
166 166 #define timeradd(tvp, uvp, vvp) \
167 167 do \
168 168 { \
169 169 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
170 170 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
171 171 if ((vvp)->tv_usec >= 1000000) \
172 172 { \
173 173 (vvp)->tv_sec++; \
174 174 (vvp)->tv_usec -= 1000000; \
175 175 } \
176 176 } while (0)
177 177
178 178 #define timersub(tvp, uvp, vvp) \
179 179 do \
180 180 { \
181 181 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
182 182 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
183 183 if ((vvp)->tv_usec < 0) \
184 184 { \
185 185 (vvp)->tv_sec--; \
186 186 (vvp)->tv_usec += 1000000; \
187 187 } \
188 188 } while (0)
189 189 #endif /* __lint */
190 190
191 191 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
192 192
193 193 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
194 194 /*
195 195 * Names of the interval timers, and structure
196 196 * defining a timer setting.
197 197 */
198 198 #define ITIMER_REAL 0 /* Decrements in real time */
199 199 #define ITIMER_VIRTUAL 1 /* Decrements in process virtual time */
200 200 #define ITIMER_PROF 2 /* Decrements both in process virtual */
201 201 /* time and when system is running on */
202 202 /* behalf of the process. */
203 203 #define ITIMER_REALPROF 3 /* Decrements in real time for real- */
204 204 /* time profiling of multithreaded */
205 205 /* programs. */
206 206
207 207 #ifndef _ASM
208 208 struct itimerval {
209 209 struct timeval it_interval; /* timer interval */
210 210 struct timeval it_value; /* current value */
211 211 };
212 212
213 213 #if defined(_SYSCALL32)
214 214
215 215 struct itimerval32 {
216 216 struct timeval32 it_interval;
217 217 struct timeval32 it_value;
218 218 };
219 219
220 220 #define ITIMERVAL32_TO_ITIMERVAL(itv, itv32) { \
221 221 TIMEVAL32_TO_TIMEVAL(&(itv)->it_interval, &(itv32)->it_interval); \
222 222 TIMEVAL32_TO_TIMEVAL(&(itv)->it_value, &(itv32)->it_value); \
223 223 }
224 224
225 225 #define ITIMERVAL_TO_ITIMERVAL32(itv32, itv) { \
226 226 TIMEVAL_TO_TIMEVAL32(&(itv32)->it_interval, &(itv)->it_interval); \
227 227 TIMEVAL_TO_TIMEVAL32(&(itv32)->it_value, &(itv)->it_value); \
228 228 }
229 229
230 230 #define ITIMERVAL_OVERFLOW(itv) \
231 231 (TIMEVAL_OVERFLOW(&(itv)->it_interval) || \
232 232 TIMEVAL_OVERFLOW(&(itv)->it_value))
233 233
234 234 #endif /* _SYSCALL32 */
235 235 #endif /* _ASM */
236 236 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
237 237
238 238
239 239 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
240 240 /*
|
↓ open down ↓ |
208 lines elided |
↑ open up ↑ |
241 241 * Definitions for commonly used resolutions.
242 242 */
243 243 #define SEC 1
244 244 #define MILLISEC 1000
245 245 #define MICROSEC 1000000
246 246 #define NANOSEC 1000000000LL
247 247
248 248 #define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
249 249 #define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
250 250
251 -#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC))
252 -#define NSEC2USEC(n) ((n) / (NANOSEC / MICROSEC))
251 +#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC))
252 +#define NSEC2USEC(n) ((n) / (NANOSEC / MICROSEC))
253 253
254 254 #define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
255 255 #define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
256 256
257 257 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
258 258
259 259 #ifndef _ASM
260 260
261 261 /*
262 262 * Time expressed as a 64-bit nanosecond counter.
263 263 */
264 264 typedef longlong_t hrtime_t;
265 265
266 266 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
267 267
268 268 /*
269 269 * Unsigned counterpart to hrtime_t
270 270 */
271 271 typedef u_longlong_t uhrtime_t;
272 272
273 273 #define HRTIME_MAX LLONG_MAX
274 274 #define UHRTIME_MAX ULLONG_MAX
275 275
276 276 #include <sys/time_impl.h>
277 277 #include <sys/mutex.h>
278 278
279 279 extern int tick_per_msec; /* clock ticks per millisecond (may be zero) */
280 280 extern int msec_per_tick; /* milliseconds per clock tick (may be zero) */
281 281 extern int usec_per_tick; /* microseconds per clock tick */
282 282 extern int nsec_per_tick; /* nanoseconds per clock tick */
283 283
284 284 /*
285 285 * Macros to convert from common units of time (sec, msec, usec, nsec,
286 286 * timeval, timestruc) to clock ticks and vice versa.
287 287 */
288 288 #define TICK_TO_SEC(tick) ((tick) / hz)
289 289 #define SEC_TO_TICK(sec) ((sec) * hz)
290 290
291 291 #define TICK_TO_MSEC(tick) \
292 292 (msec_per_tick ? (tick) * msec_per_tick : (tick) / tick_per_msec)
293 293 #define MSEC_TO_TICK(msec) \
294 294 (msec_per_tick ? (msec) / msec_per_tick : (msec) * tick_per_msec)
295 295 #define MSEC_TO_TICK_ROUNDUP(msec) \
296 296 (msec_per_tick ? \
297 297 ((msec) == 0 ? 0 : ((msec) - 1) / msec_per_tick + 1) : \
298 298 (msec) * tick_per_msec)
299 299
300 300 #define TICK_TO_USEC(tick) ((tick) * usec_per_tick)
301 301 #define USEC_TO_TICK(usec) ((usec) / usec_per_tick)
302 302 #define USEC_TO_TICK_ROUNDUP(usec) \
303 303 ((usec) == 0 ? 0 : USEC_TO_TICK((usec) - 1) + 1)
304 304
305 305 #define TICK_TO_NSEC(tick) ((hrtime_t)(tick) * nsec_per_tick)
306 306 #define NSEC_TO_TICK(nsec) ((nsec) / nsec_per_tick)
307 307 #define NSEC_TO_TICK_ROUNDUP(nsec) \
308 308 ((nsec) == 0 ? 0 : NSEC_TO_TICK((nsec) - 1) + 1)
309 309
310 310 #define TICK_TO_TIMEVAL(tick, tvp) { \
311 311 clock_t __tmptck = (tick); \
312 312 (tvp)->tv_sec = TICK_TO_SEC(__tmptck); \
313 313 (tvp)->tv_usec = TICK_TO_USEC(__tmptck - SEC_TO_TICK((tvp)->tv_sec)); \
314 314 }
315 315
316 316 #define TICK_TO_TIMEVAL32(tick, tvp) { \
317 317 clock_t __tmptck = (tick); \
318 318 time_t __tmptm = TICK_TO_SEC(__tmptck); \
319 319 (tvp)->tv_sec = (time32_t)__tmptm; \
320 320 (tvp)->tv_usec = TICK_TO_USEC(__tmptck - SEC_TO_TICK(__tmptm)); \
321 321 }
322 322
323 323 #define TICK_TO_TIMESTRUC(tick, tsp) { \
324 324 clock_t __tmptck = (tick); \
325 325 (tsp)->tv_sec = TICK_TO_SEC(__tmptck); \
326 326 (tsp)->tv_nsec = TICK_TO_NSEC(__tmptck - SEC_TO_TICK((tsp)->tv_sec)); \
327 327 }
328 328
329 329 #define TICK_TO_TIMESTRUC32(tick, tsp) { \
330 330 clock_t __tmptck = (tick); \
331 331 time_t __tmptm = TICK_TO_SEC(__tmptck); \
332 332 (tsp)->tv_sec = (time32_t)__tmptm; \
333 333 (tsp)->tv_nsec = TICK_TO_NSEC(__tmptck - SEC_TO_TICK(__tmptm)); \
334 334 }
335 335
336 336 #define TIMEVAL_TO_TICK(tvp) \
337 337 (SEC_TO_TICK((tvp)->tv_sec) + USEC_TO_TICK((tvp)->tv_usec))
338 338
339 339 #define TIMESTRUC_TO_TICK(tsp) \
340 340 (SEC_TO_TICK((tsp)->tv_sec) + NSEC_TO_TICK((tsp)->tv_nsec))
341 341
342 342 typedef struct todinfo {
343 343 int tod_sec; /* seconds 0-59 */
344 344 int tod_min; /* minutes 0-59 */
345 345 int tod_hour; /* hours 0-23 */
346 346 int tod_dow; /* day of week 1-7 */
347 347 int tod_day; /* day of month 1-31 */
348 348 int tod_month; /* month 1-12 */
349 349 int tod_year; /* year 70+ */
350 350 } todinfo_t;
351 351
352 352 extern int64_t timedelta;
353 353 extern int timechanged;
354 354 extern int tod_needsync;
355 355 extern kmutex_t tod_lock;
356 356 extern volatile timestruc_t hrestime;
357 357 extern hrtime_t hres_last_tick;
358 358 extern int64_t hrestime_adj;
359 359 extern uint_t adj_shift;
360 360
361 361 extern timestruc_t tod_get(void);
362 362 extern void tod_set(timestruc_t);
363 363 extern void set_hrestime(timestruc_t *);
364 364 extern todinfo_t utc_to_tod(time_t);
365 365 extern time_t tod_to_utc(todinfo_t);
366 366 extern int hr_clock_lock(void);
367 367 extern void hr_clock_unlock(int);
368 368 extern hrtime_t gethrtime(void);
369 369 extern hrtime_t gethrtime_unscaled(void);
370 370 extern hrtime_t gethrtime_max(void);
371 371 extern hrtime_t gethrtime_waitfree(void);
372 372 extern void scalehrtime(hrtime_t *);
373 373 extern uint64_t unscalehrtime(hrtime_t);
374 374 extern void gethrestime(timespec_t *);
375 375 extern time_t gethrestime_sec(void);
376 376 extern void gethrestime_lasttick(timespec_t *);
377 377 extern void hrt2ts(hrtime_t, timestruc_t *);
378 378 extern hrtime_t ts2hrt(const timestruc_t *);
379 379 extern void hrt2tv(hrtime_t, struct timeval *);
380 380 extern hrtime_t tv2hrt(struct timeval *);
381 381 extern int itimerfix(struct timeval *, int);
382 382 extern int itimerdecr(struct itimerval *, int);
383 383 extern void timevaladd(struct timeval *, struct timeval *);
384 384 extern void timevalsub(struct timeval *, struct timeval *);
385 385 extern void timevalfix(struct timeval *);
386 386 extern void dtrace_hres_tick(void);
387 387
388 388 extern clock_t ddi_get_lbolt(void);
389 389 extern int64_t ddi_get_lbolt64(void);
390 390
391 391 #if defined(_SYSCALL32)
392 392 extern void hrt2ts32(hrtime_t, timestruc32_t *);
393 393 #endif
394 394
395 395 #endif /* _KERNEL */
396 396
397 397 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
398 398 int adjtime(struct timeval *, struct timeval *);
399 399 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
400 400
401 401 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
402 402 defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)
403 403 int futimesat(int, const char *, const struct timeval *);
404 404 #endif /* defined(__ATFILE_SOURCE) */
405 405
406 406 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
407 407 defined(__EXTENSIONS__)
408 408
409 409 int getitimer(int, struct itimerval *);
410 410 int utimes(const char *, const struct timeval *);
411 411 #if defined(_XPG4_2)
412 412 int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
413 413 struct itimerval *_RESTRICT_KYWD);
414 414 #else
415 415 int setitimer(int, struct itimerval *_RESTRICT_KYWD,
416 416 struct itimerval *_RESTRICT_KYWD);
417 417 #endif /* defined(_XPG2_2) */
418 418
419 419 #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
420 420
421 421 /*
422 422 * gettimeofday() and settimeofday() were included in SVr4 due to their
423 423 * common use in BSD based applications. They were to be included exactly
424 424 * as in BSD, with two parameters. However, AT&T/USL noted that the second
425 425 * parameter was unused and deleted it, thereby making a routine included
426 426 * for compatibility, incompatible.
427 427 *
428 428 * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
429 429 * parameters.
430 430 *
431 431 * This has caused general disagreement in the application community as to
432 432 * the syntax of these routines. Solaris defaults to the XSH4.2 definition.
433 433 * The flag _SVID_GETTOD may be used to force the SVID version.
434 434 */
435 435 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
436 436
437 437 #if defined(_SVID_GETTOD)
438 438 int settimeofday(struct timeval *);
439 439 #else
440 440 int settimeofday(struct timeval *, void *);
441 441 #endif
442 442 hrtime_t gethrtime(void);
443 443 hrtime_t gethrvtime(void);
444 444
445 445 #endif /* !(defined _KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
446 446
447 447 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
448 448 defined(__EXTENSIONS__)
449 449
450 450 #if defined(_SVID_GETTOD)
451 451 int gettimeofday(struct timeval *);
452 452 #else
453 453 int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
454 454 #endif
455 455
456 456 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
457 457
458 458 /*
459 459 * The inclusion of <time.h> is historical and was added for
460 460 * backward compatibility in delta 1.2 when a number of definitions
461 461 * were moved out of <sys/time.h>. More recently, the timespec and
462 462 * itimerspec structure definitions, along with the _CLOCK_*, CLOCK_*,
463 463 * _TIMER_*, and TIMER_* symbols were moved to <sys/time_impl.h>,
464 464 * which is now included by <time.h>. This change was due to POSIX
465 465 * 1003.1b-1993 and X/Open UNIX 98 requirements. For non-POSIX and
466 466 * non-X/Open applications, including this header will still make
467 467 * visible these definitions.
468 468 */
469 469 #if !defined(_BOOT) && !defined(_KERNEL) && !defined(_FAKE_KERNEL) && \
470 470 !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
471 471 #include <time.h>
472 472 #endif
473 473
474 474 /*
475 475 * The inclusion of <sys/select.h> is needed for the FD_CLR,
476 476 * FD_ISSET, FD_SET, and FD_SETSIZE macros as well as the
477 477 * select() prototype defined in the XOpen specifications
478 478 * beginning with XSH4v2. Placement required after definition
479 479 * for itimerval.
480 480 */
481 481 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL) && \
482 482 !defined(__XOPEN_OR_POSIX) || \
483 483 defined(_XPG4_2) || defined(__EXTENSIONS__)
484 484 #include <sys/select.h>
485 485 #endif
486 486
487 487 #endif /* _ASM */
488 488
489 489 #ifdef __cplusplus
490 490 }
491 491 #endif
492 492
493 493 #endif /* _SYS_TIME_H */
|
↓ open down ↓ |
231 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX