File: info.cc

package info (click to toggle)
bobcat 6.11.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,292 kB
  • sloc: cpp: 21,370; fortran: 6,507; makefile: 2,787; sh: 724; perl: 401; ansic: 26
file content (39 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download
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
#define XERR "memoryaccess"
#include "memoryaccess.ih"

    // by memorybridge/info.cc

void MemoryAccess::info(ostream &out) const
{
    out <<  "MemoryAccess ID: " << d_id << "\n"
            "maximum size: " << d_maxEnd << "\n"
            "# blocks: " << d_nBlocks << "\n"
            "block size: " << d_blockSize << '\n';

    size_t idx;
    for (idx = 0; idx != d_nBlocks; ++idx)      // find the 1st block idx
    {
        if (d_block[idx] != -1)
            break;
    }
    
    if (idx == d_nBlocks)
        cout << "no connected data blocks\n";
    else
    {
        for (idx = 0; idx != d_nBlocks; ++idx)      // details of known blocks
        {
            if (int id = d_block[idx]; id != -1)
            {
                size_t offset = idx * d_blockSize;
                cout << "data block " << idx << ": id = " << id << 
                        " (offsets: " << offset << " to " <<
                                         (offset + d_blockSize) << ")\n";
            }
        }
    }
}