Exemple #1
0
void ra_aloha_ss_init(void)
{
    Objid my_objid;

    FIN(ra_aloha_ss_init());

    /*
     *
     * stream    :  MAC [0] -> rt_0 [0]
     * stream    :  MAC [1] -> sink [0]
     * stream    :  rr_0 [0] -> MAC [0]
     * stream    :  traffic [0] -> MAC [1]
     */
    svptr = (struct SS_SVar*) op_prg_mem_alloc(sizeof (struct SS_SVar));

    svptr->istrm_hl=1;
    svptr->istrm_ll=0;
    svptr->ostrm_hl=1;
    svptr->ostrm_ll=0;

    my_objid = op_id_self();
    op_ima_obj_attr_get_int32(my_objid, "SS ID", & svptr->ss_id);

    svptr->sh_load_bits = op_stat_reg("ALOHA SS.Load(bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
    svptr->sh_goodput_bits = op_stat_reg("ALOHA SS.Goodput(bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);
    svptr->gsh_load_bits = op_stat_reg("ALOHA SS.Load(bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);

    FOUT;
}
Exemple #2
0
AodvT_Global_Stathandles*
aodv_support_global_stat_handles_obtain (void)
	{
	static Boolean		   					stat_handles_registered = OPC_FALSE;
	static AodvT_Global_Stathandles*		stat_handle_ptr = OPC_NIL;
	
	/** Registers the global statistics and returns a	**/
	/** handle to the global statistics					**/
	FIN (aodv_support_global_stat_handles_obtain (void));
	
	if (stat_handles_registered == OPC_FALSE)
		{
		/* The statistic handles have not yet been registered	*/
		/* Register the global statistic handles				*/
		stat_handle_ptr = (AodvT_Global_Stathandles*) op_prg_mem_alloc (sizeof (AodvT_Global_Stathandles));
		
		stat_handle_ptr->route_discovery_time_global_shandle = op_stat_reg ("AODV.Route Discovery Time", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->num_hops_global_shandle = op_stat_reg ("AODV.Number of Hops per Route", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->num_pkts_discard_global_shandle = op_stat_reg ("AODV.Total Packets Dropped", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->rte_traf_rcvd_bps_global_shandle = op_stat_reg ("AODV.Routing Traffic Received (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->rte_traf_rcvd_pps_global_shandle = op_stat_reg ("AODV.Routing Traffic Received (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->rte_traf_sent_bps_global_shandle = op_stat_reg ("AODV.Routing Traffic Sent (bits/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->rte_traf_sent_pps_global_shandle = op_stat_reg ("AODV.Routing Traffic Sent (pkts/sec)", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->total_requests_sent_global_shandle = op_stat_reg ("AODV.Total Route Requests Sent", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->total_replies_sent_global_shandle = op_stat_reg ("AODV.Total Route Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->total_replies_sent_from_dest_global_shandle = op_stat_reg ("AODV.Total Replies Sent from Destination", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->total_cached_replies_sent_global_shandle = op_stat_reg ("AODV.Total Cached Replies Sent", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->total_route_errors_sent_global_shandle = op_stat_reg ("AODV.Total Route Errors Sent", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		stat_handle_ptr->num_aodv_fallbacks_global_shandle = op_stat_reg ("AODV.Number of AODV Fallbacks", OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);
		
		/* Set the flag to indicate that the statistics	*/
		/* have been registered							*/
		stat_handles_registered = OPC_TRUE;
		}
	
	FRET (stat_handle_ptr);
	}