~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_time.h

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
3
 * 
4
 
 * Copyright Ericsson AB 2006-2009. All Rights Reserved.
 
4
 * Copyright Ericsson AB 2006-2011. All Rights Reserved.
5
5
 * 
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
20
20
#ifndef ERL_TIME_H__
21
21
#define ERL_TIME_H__
22
22
 
 
23
extern erts_smp_atomic_t do_time;       /* set at clock interrupt */
 
24
extern SysTimeval erts_first_emu_time;
 
25
 
23
26
/*
24
27
** Timer entry:
25
28
*/
26
29
typedef struct erl_timer {
27
30
    struct erl_timer* next;     /* next entry tiw slot or chain */
 
31
    struct erl_timer* prev;     /* prev entry tiw slot or chain */
28
32
    Uint slot;                  /* slot in timer wheel */
29
33
    Uint count;                 /* number of loops remaining */
30
34
    int    active;              /* 1=activated, 0=deactivated */
39
43
typedef void (*ErlCancelProc)(void*);
40
44
 
41
45
#ifdef ERTS_SMP
42
 
 
43
46
/*
44
47
 * Process and port timer
45
48
 */
61
64
                            ErlTimeoutProc timeout_func,
62
65
                            Uint timeout);
63
66
void erts_cancel_smp_ptimer(ErtsSmpPTimer *ptimer);
64
 
 
65
 
#endif
66
 
 
67
 
#endif
 
67
#endif
 
68
 
 
69
/* timer-wheel api */
 
70
 
 
71
void erts_init_time(void);
 
72
void erts_set_timer(ErlTimer*, ErlTimeoutProc, ErlCancelProc, void*, Uint);
 
73
void erts_cancel_timer(ErlTimer*);
 
74
void erts_bump_timer(erts_aint_t);
 
75
Uint erts_timer_wheel_memory_size(void);
 
76
Uint erts_time_left(ErlTimer *);
 
77
erts_aint_t erts_next_time(void);
 
78
 
 
79
#ifdef DEBUG
 
80
void erts_p_slpq(void);
 
81
#endif
 
82
 
 
83
ERTS_GLB_INLINE erts_aint_t erts_do_time_read_and_reset(void);
 
84
ERTS_GLB_INLINE void erts_do_time_add(long);
 
85
 
 
86
#if ERTS_GLB_INLINE_INCL_FUNC_DEF
 
87
 
 
88
ERTS_GLB_INLINE erts_aint_t erts_do_time_read_and_reset(void) { return erts_smp_atomic_xchg(&do_time, 0L); }
 
89
ERTS_GLB_INLINE void erts_do_time_add(long elapsed) { erts_smp_atomic_add(&do_time, elapsed); }
 
90
 
 
91
#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */
 
92
 
 
93
 
 
94
/* time_sup */
 
95
 
 
96
#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME))
 
97
#  ifndef HAVE_ERTS_NOW_CPU
 
98
#    define HAVE_ERTS_NOW_CPU
 
99
#    ifdef HAVE_GETHRVTIME
 
100
#      define erts_start_now_cpu() sys_start_hrvtime()
 
101
#      define erts_stop_now_cpu()  sys_stop_hrvtime()
 
102
#    endif
 
103
#  endif
 
104
void erts_get_now_cpu(Uint* megasec, Uint* sec, Uint* microsec);
 
105
#endif
 
106
 
 
107
void erts_get_timeval(SysTimeval *tv);
 
108
long erts_get_time(void);
 
109
void erts_get_emu_time(SysTimeval *);
 
110
 
 
111
ERTS_GLB_INLINE int erts_cmp_timeval(SysTimeval *t1p, SysTimeval *t2p);
 
112
 
 
113
#if ERTS_GLB_INLINE_INCL_FUNC_DEF
 
114
 
 
115
ERTS_GLB_INLINE int
 
116
erts_cmp_timeval(SysTimeval *t1p, SysTimeval *t2p)
 
117
{
 
118
    if (t1p->tv_sec == t2p->tv_sec) {
 
119
        if (t1p->tv_usec < t2p->tv_usec)
 
120
            return -1;
 
121
        else if (t1p->tv_usec > t2p->tv_usec)
 
122
            return 1;
 
123
        return 0;
 
124
    }
 
125
    return t1p->tv_sec < t2p->tv_sec ? -1 : 1;
 
126
}
 
127
 
 
128
#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */
 
129
#endif /* ERL_TIME_H__ */