Deleted Added
sdiff udiff text old ( 194850 ) new ( 195710 )
full compact
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 *

--- 5 unchanged lines hidden (view full) ---

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 * $FreeBSD: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c 194850 2009-06-24 16:03:57Z avg $
23 *
24 */
25/*
26 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#include <sys/param.h>

--- 330 unchanged lines hidden (view full) ---

361
362 return (1);
363}
364#endif
365
366static int64_t tgt_cpu_tsc;
367static int64_t hst_cpu_tsc;
368static int64_t tsc_skew[MAXCPU];
369
370static void
371dtrace_gethrtime_init_sync(void *arg)
372{
373#ifdef CHECK_SYNC
374 /*
375 * Delay this function from returning on one
376 * of the CPUs to check that the synchronisation
377 * works.

--- 18 unchanged lines hidden (view full) ---

396 tgt_cpu_tsc = rdtsc();
397 else
398 hst_cpu_tsc = rdtsc();
399}
400
401static void
402dtrace_gethrtime_init(void *arg)
403{
404 cpumask_t map;
405 int i;
406 struct pcpu *cp;
407
408 /* The current CPU is the reference one. */
409 tsc_skew[curcpu] = 0;
410
411 for (i = 0; i <= mp_maxid; i++) {
412 if (i == curcpu)
413 continue;
414
415 if ((cp = pcpu_find(i)) == NULL)
416 continue;
417
418 map = 0;
419 map |= (1 << curcpu);
420 map |= (1 << i);
421
422 smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync,
423 dtrace_gethrtime_init_cpu,

--- 10 unchanged lines hidden (view full) ---

434 * be called from a probe context and guaranteed not to have
435 * instrumented with probes itself.
436 *
437 * Returns nanoseconds since boot.
438 */
439uint64_t
440dtrace_gethrtime()
441{
442 return ((rdtsc() + tsc_skew[curcpu]) * (int64_t) 1000000000 / tsc_freq);
443}
444
445uint64_t
446dtrace_gethrestime(void)
447{
448 printf("%s(%d): XXX\n",__func__,__LINE__);
449 return (0);
450}

--- 56 unchanged lines hidden ---