te call graph size
	set cgsize [calc_cg_size $sname $cputype]

	# Calculate histogram size
	set highpc [dict get $secdict highpc]
	set lowpc [dict get $secdict lowpc]
	set histcount [expr [expr $highpc - $lowpc] / [expr 4 * $histbinsize]]
	set histsize [roundup [expr $histcount * 2] 4]

	## Update the sizes in the dict
	set retdict [dict create secname $sname lowpc $lowpc highpc $highpc cgsize $cgsize histcount $histcount histsize $histsize]
	lappend gmonparamstruct $retdict

	return $retdict
    }

    #---------------------------------------------------------------------------------------#
    # Calculate call graph size
    #---------------------------------------------------------------------------------------#
    proc calc_cg_size {sname cputype} {
	variable elf
	variable bigendian
	set calltype 0
	set fmt "iu*"
	set fc_cnt 0
	set fpc_cnt 0
	set secdata [$elf get_elf_section_data $sname]

	if { $bigendian == 1 } {
	    set fmt [string toupper $fmt 0 0]
	}

	set bindata [dict get $secdata $sname secbin]
	binary scan $bindata $fmt inst

	for {set i 0} {$i < [llength $inst]} {incr i} {
	    switch -- $cputype {
		"Cortex-A9" {
		    set calltype [is_func_call_instr_a9 [lindex $inst $i]]
		}
		"MicroBlaze" {
		    set calltype [is_func_call_instr_mb [lindex $inst $i]]
		}
	    }
	    if { $calltype == 1 } {
		incr fc_cnt
	    } elseif { $calltype == 2 } {
		incr fpc_cnt
	    }
	}
	# Call Graph Mem Size 	= Size for FromStruct + Size for TosStruct
	# 			= (Total Num of Calls * FromStructSize) +  ((Num of Func Calls + (Num of FuncPtr Calls * ~Num of Target Calls)) * TosStructSize)
	# cgmemsize = [ {(fc + fpc)*12} + {(fc + fpc*5)*12} ]
	set cgmemsize [expr [expr [expr $fc_cnt + $fpc_cnt] * 12] + [expr [expr $fc_cnt + [expr $fpc_cnt * 5]] * 12]]
	return [roundup $cgmemsize 4]
    }

    #---------------------------------------------------------------------------------------#
    # Check func call instructions for A9 & R5
    #---------------------------------------------------------------------------------------#
    proc is_func_call_instr_a9 {instr} {
	set calltype [expr {$instr & 0x0F000000}]
	if { $calltype == 0x01000000 } {
	    if { [expr {$instr & 0x002FFF30}] == 0x002FFF30 } {
		# Func pointer call type
		return 2
	    }
	} elseif { $calltype == 0x0B000000 } {
	    # Func call type
	    return 1
	}
	return 0
    }

    #---------------------------------------------------------------------------------------#
    # Check func call instructions for MB
    #---------------------------------------------------------------------------------------#
    proc is_func_call_instr_mb {instr} {
	set calltype [format 0x%x [expr {$instr >> 26}]]
	set brtype [format 0x%x [expr [expr {$instr >> 16}] & 0x1F]]
	if { $calltype == 0x26 } {
	    # brld & brald (func pointer call)
	    if { ($brtype == 0x14) || ($brtype == 0x1c) } {
	        return 2
	    }
        } elseif { $calltype == 0x2e } {
	    # brlid & bralid (func call)
	    if { ($brtype == 0x14) || ($brtype == 0x1c) } {
	        return 1
	    }
	}
	return 0
    }

    #---