Changes between Version 2 and Version 3 of PortableRrdFormat


Ignore:
Timestamp:
Jun 20, 2007, 10:05:06 PM (15 years ago)
Author:
oetiker
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PortableRrdFormat

    v2 v3  
    117117== Data alignment differences ==
    118118
    119 Most of todays workstations run either 32 or 64 bit. This also influences the structure.
     119Most of today's workstations run either 32 or 64 bit. This also has an influence on the data layout. The classic RRDtool data format heavily relies on doubles and longs, bundled into structs. This is a challenging mix for portability:
     120
     121 * longs are 4 bytes long in 32bit OSes. In 64 bit OSes, they are often represented as
     122   8 byte integers.
     123 * struct members are aligned to either 32 bit or 64 bit boundaries.
     124
     125Below is an example of a the memory layout of several simple structs, made up from integers(32bit) and doubles(64bit).
     126
     127{{{
     12832 Bit (16 Byte) : IIII.DDDD.DDDD.IIII
     12964 Bit (24 Byte) : IIII ~~~~.DDDD DDDD.IIII ~~~~
     130
     13132 Bit (12 Byte) : IIII.IIII.IIII
     13264 Bit (12 Byte) : IIII IIII.IIII
     133
     13432 Bit (16 Byte) : IIII.IIII.DDDD.DDDD.IIII.IIII
     13564 Bit (24 Byte) : IIII IIII.DDDD DDDD.IIII IIII
     136}}}
     137
     138This means, that in order to produce a portable data format, structs must be layed out such that they are aligned the same, on 32 and 64 bit systems.
     139
     140
     141+------------------------+
     142   | 32 bit     | 64 bit    |
     143   +------------------------+
     144   | int        |           |
     145   | int        |           |
     146   | int        |           |
     147   | int        |           |
     148   |............|           |           
     149   |            |           |
     150   |            |           |
     151   |            |           |
     152   |            |           |
     153   |............|...........|
     154

NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.