aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/time.h
blob: 104b6112127e6914c5de6e1ecea8097e5c16892a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/****************************************************************************
 * (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
 ****************************************************************************
 *
 *        File: time.h
 *      Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
 *     Changes: 
 *              
 *        Date: Nov 2002
 * 
 * Environment: Xen Hypervisor
 * Description: This file provides a one stop shop for all time related
 *              issues within the hypervisor. 
 * 
 *              The Hypervisor provides the following notions of time:
 *              Cycle Counter Time, System Time, Wall Clock Time, and 
 *              Domain Virtual Time.
 *
 ****************************************************************************
 * $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
 ****************************************************************************
 */



#ifndef __XEN_TIME_H__
#define __XEN_TIME_H__

#include <xen/types.h>
#include <public/xen.h>
#include <asm/time.h>

extern int init_xen_time();

extern unsigned long cpu_khz;

struct domain;

/*
 * System Time
 * 64 bit value containing the nanoseconds elapsed since boot time.
 * This value is adjusted by frequency drift.
 * NOW() returns the current time.
 * The other macros are for convenience to approximate short intervals
 * of real time into system time 
 */

typedef s64 s_time_t;

s_time_t get_s_time(void);

#define NOW()           ((s_time_t)get_s_time())
#define SECONDS(_s)     (((s_time_t)(_s))  * 1000000000ULL )
#define MILLISECS(_ms)  (((s_time_t)(_ms)) * 1000000ULL )
#define MICROSECS(_us)  (((s_time_t)(_us)) * 1000ULL )

extern void update_dom_time(struct exec_domain *ed);
extern void do_settime(
    unsigned long secs, unsigned long usecs, u64 system_time_base);

#endif /* __XEN_TIME_H__ */

/*
 * Local variables:
 * mode: C
 * c-set-style: "BSD"
 * c-basic-offset: 4
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */