#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Compounds | |
struct | reference_record_s |
A record structure in which a reference record will be passed and stored. More... | |
Typedefs | |
typedef char | tag_t |
The type for the tag that indicates the type of a reference. | |
typedef unsigned long long int | timestamp_t |
The type for the cycle counter timestamp. | |
typedef unsigned char | length_t |
The type for length values. | |
typedef unsigned long int | address_space_ID_t |
The type for the address space identifier, a.k.a. the page number holding the base level of the page table. | |
typedef unsigned long int | address_t |
The type for virtual addresses. | |
Functions | |
int | main (const unsigned int argc, const char **const argv) |
The entry point. | |
Variables | |
const tag_t | TAG_END_OF_TRACE = 'e' |
Definition in file main.cc.
|
The type for the address space identifier, a.k.a. the page number holding the base level of the page table.
|
|
The type for virtual addresses.
|
|
The type for length values.
|
|
The type for the tag that indicates the type of a reference.
|
|
The type for the cycle counter timestamp.
|
|
The entry point.
Definition at line 85 of file main.cc. References reference_record_s::tag, and TAG_END_OF_TRACE.
00085 { 00086 00087 // Were the correct number of arguments passed? 00088 if (argc != 1) { 00089 00090 // No. Emit usage and exit. 00091 fprintf(stderr, "Usage: %s <NO ARGUMENTS>\n", argv[0]); 00092 return 1; 00093 00094 } 00095 00096 // Allocate a single reference record into which the binary source 00097 // will be read, one record at a time. 00098 reference_record_s binary_record; 00099 00100 // Read binary records until the end of the trace has been reached. 00101 do { 00102 00103 // Attempt to read the next record. 00104 size_t read_result = fread(&binary_record, 00105 sizeof(binary_record), 00106 1, 00107 stdin); 00108 00109 // Ensure that the read succeeded; otherwise, bail out. 00110 if (read_result != 1) { 00111 00112 if (feof(stdin)) { 00113 fprintf(stderr, "Premature EOF\n"); 00114 } else { 00115 fprintf(stderr, "Failed in reading binary record\n"); 00116 } 00117 00118 exit(1); 00119 00120 } 00121 00122 // Emit the binary record as text. If the record is the 00123 // end-of-trace record, then emit just the tag. 00124 if (binary_record.tag == TAG_END_OF_TRACE) { 00125 00126 printf("%c\n", binary_record.tag); 00127 00128 } else { 00129 00130 printf("%c %qx %hx %lx %lx\n", 00131 binary_record.tag, 00132 binary_record.timestamp, 00133 binary_record.length, 00134 binary_record.address_space_ID, 00135 binary_record.virtual_address); 00136 00137 } 00138 00139 } while (binary_record.tag != TAG_END_OF_TRACE); 00140 00141 // Exit successfully. 00142 return 0; 00143 00144 } // main |
|
Definition at line 65 of file main.cc. Referenced by main(). |