21 int inode, length, seg_type, max_segment_length, cost_index;
22 int *seg_occ_by_length, *seg_cap_by_length;
23 int *seg_occ_by_type, *seg_cap_by_type;
26 max_segment_length = 0;
27 for (seg_type = 0; seg_type < num_segment; seg_type++) {
28 if (segment_inf[seg_type].longline ==
FALSE)
29 max_segment_length =
std::max(max_segment_length,
30 segment_inf[seg_type].length);
33 seg_occ_by_length = (
int *)
my_calloc((max_segment_length + 1),
35 seg_cap_by_length = (
int *)
my_calloc((max_segment_length + 1),
38 seg_occ_by_type = (
int *)
my_calloc(num_segment,
sizeof(
int));
39 seg_cap_by_type = (
int *)
my_calloc(num_segment,
sizeof(
int));
46 if (!segment_inf[seg_type].longline)
47 length = segment_inf[seg_type].
length;
51 seg_occ_by_length[length] +=
rr_node[inode].
occ;
53 seg_occ_by_type[seg_type] +=
rr_node[inode].
occ;
60 vpr_printf(TIO_MESSAGE_INFO,
"Segment usage by type (index):\n");
61 vpr_printf(TIO_MESSAGE_INFO,
"Segment type Fractional utilization\n");
62 vpr_printf(TIO_MESSAGE_INFO,
"------------ ----------------------\n");
64 for (seg_type = 0; seg_type < num_segment; seg_type++) {
65 if (seg_cap_by_type[seg_type] != 0) {
66 utilization = (float) seg_occ_by_type[seg_type] / (
float) seg_cap_by_type[seg_type];
67 vpr_printf(TIO_MESSAGE_INFO,
"%8d %5.3g\n", seg_type, utilization);
72 vpr_printf(TIO_MESSAGE_INFO,
"Segment usage by length:\n");
73 vpr_printf(TIO_MESSAGE_INFO,
"Segment length Fractional utilization\n");
74 vpr_printf(TIO_MESSAGE_INFO,
"-------------- ----------------------\n");
76 for (length = 1; length <= max_segment_length; length++) {
77 if (seg_cap_by_length[length] != 0) {
78 utilization = (float) seg_occ_by_length[length] / (
float) seg_cap_by_length[length];
79 vpr_printf(TIO_MESSAGE_INFO,
"%9d %5.3g\n", length, utilization);
84 if (seg_cap_by_length[
LONGLINE] != 0) {
85 utilization = (float) seg_occ_by_length[
LONGLINE] / (
float) seg_cap_by_length[
LONGLINE];
86 vpr_printf(TIO_MESSAGE_INFO,
" longline %5.3g\n", utilization);
89 free(seg_occ_by_length);
90 free(seg_cap_by_length);
91 free(seg_occ_by_type);
92 free(seg_cap_by_type);
t_rr_indexed_data * rr_indexed_data
void get_segment_usage_stats(int num_segment, t_segment_inf *segment_inf)
void * my_calloc(size_t nelem, size_t size)