VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/common/constants/valueunit.py@ 64744

Last change on this file since 64744 was 62484, checked in by vboxsync, 8 years ago

(C) 2016

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: valueunit.py 62484 2016-07-22 18:35:33Z vboxsync $
3
4"""
5Test Value Unit Definititions.
6
7This must correspond 1:1 with include/iprt/test.h and
8include/VBox/VMMDevTesting.h.
9"""
10
11__copyright__ = \
12"""
13Copyright (C) 2012-2016 Oracle Corporation
14
15This file is part of VirtualBox Open Source Edition (OSE), as
16available from http://www.virtualbox.org. This file is free software;
17you can redistribute it and/or modify it under the terms of the GNU
18General Public License (GPL) as published by the Free Software
19Foundation, in version 2 as it comes in the "COPYING" file of the
20VirtualBox OSE distribution. VirtualBox OSE is distributed in the
21hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
22
23The contents of this file may alternatively be used under the terms
24of the Common Development and Distribution License Version 1.0
25(CDDL) only, as it comes in the "COPYING.CDDL" file of the
26VirtualBox OSE distribution, in which case the provisions of the
27CDDL are applicable instead of those of the GPL.
28
29You may elect to license modified versions of this file under the
30terms and conditions of either the GPL or the CDDL or both.
31"""
32__version__ = "$Revision: 62484 $"
33
34
35
36## @name Unit constants.
37## Used everywhere.
38## @note Using upper case here so we can copy, past and chop from the other
39# headers.
40## @{
41PCT = 0x01;
42BYTES = 0x02;
43BYTES_PER_SEC = 0x03;
44KILOBYTES = 0x04;
45KILOBYTES_PER_SEC = 0x05;
46MEGABYTES = 0x06;
47MEGABYTES_PER_SEC = 0x07;
48PACKETS = 0x08;
49PACKETS_PER_SEC = 0x09;
50FRAMES = 0x0a;
51FRAMES_PER_SEC = 0x0b;
52OCCURRENCES = 0x0c;
53OCCURRENCES_PER_SEC = 0x0d;
54CALLS = 0x0e;
55CALLS_PER_SEC = 0x0f;
56ROUND_TRIP = 0x10;
57SECS = 0x11;
58MS = 0x12;
59NS = 0x13;
60NS_PER_CALL = 0x14;
61NS_PER_FRAME = 0x15;
62NS_PER_OCCURRENCE = 0x16;
63NS_PER_PACKET = 0x17;
64NS_PER_ROUND_TRIP = 0x18;
65INSTRS = 0x19;
66INSTRS_PER_SEC = 0x1a;
67NONE = 0x1b;
68PP1K = 0x1c;
69PP10K = 0x1d;
70PPM = 0x1e;
71PPB = 0x1f;
72END = 0x20;
73## @}
74
75
76## Translate constant to string.
77g_asNames = \
78[
79 'invalid', # 0
80 '%',
81 'bytes',
82 'bytes/s',
83 'KiB',
84 'KiB/s',
85 'MiB',
86 'MiB/s',
87 'packets',
88 'packets/s',
89 'frames',
90 'frames/s',
91 'occurrences',
92 'occurrences/s',
93 'calls',
94 'calls/s',
95 'roundtrips',
96 's',
97 'ms',
98 'ns',
99 'ns/call',
100 'ns/frame',
101 'ns/occurrences',
102 'ns/packet',
103 'ns/roundtrips',
104 'ins',
105 'ins/s',
106 '', # none
107 'pp1k',
108 'pp10k',
109 'ppm',
110 'ppb',
111];
112assert g_asNames[PP1K] == 'pp1k';
113
114
115## Translation table for XML -> number.
116g_kdNameToConst = \
117{
118 'KB': KILOBYTES,
119 'KB/s': KILOBYTES_PER_SEC,
120 'MB': MEGABYTES,
121 'MB/s': MEGABYTES_PER_SEC,
122 'occurrences': OCCURRENCES,
123 'occurrences/s': OCCURRENCES_PER_SEC,
124
125};
126for i in range(1, len(g_asNames)):
127 g_kdNameToConst[g_asNames[i]] = i;
128
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette