⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monitor.c

📁 eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "UNREACH",
                             icmp6stat.icp6s_inhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "REDIRECT",
                             icmp6stat.icp6s_inhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Other",
                             icmp6stat.icp6s_inhist[ICMP_SOURCEQUENCH]+
                             icmp6stat.icp6s_inhist[ICMP_ROUTERADVERT]+
                             icmp6stat.icp6s_inhist[ICMP_ROUTERSOLICIT]+
                             icmp6stat.icp6s_inhist[ICMP_TIMXCEED]+
                             icmp6stat.icp6s_inhist[ICMP_PARAMPROB]+
                             icmp6stat.icp6s_inhist[ICMP_TSTAMP]+
                             icmp6stat.icp6s_inhist[ICMP_TSTAMPREPLY]+
                             icmp6stat.icp6s_inhist[ICMP_IREQ]+
                             icmp6stat.icp6s_inhist[ICMP_IREQREPLY]+
                             icmp6stat.icp6s_inhist[ICMP_MASKREQ]+
                             icmp6stat.icp6s_inhist[ICMP_MASKREPLY]
                        );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Bad",
                             icmp6stat.icp6s_badcode+
                             icmp6stat.icp6s_tooshort+
                             icmp6stat.icp6s_checksum+
                             icmp6stat.icp6s_badlen
                        );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO",
                             icmp6stat.icp6s_outhist[ICMP_ECHO] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "ECHO REPLY",
                             icmp6stat.icp6s_outhist[ICMP_ECHOREPLY] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "UNREACH",
                             icmp6stat.icp6s_outhist[ICMP_UNREACH] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "REDIRECT",
                             icmp6stat.icp6s_outhist[ICMP_REDIRECT] );
                    fprintf( client, "<tr><td>%s<td>%lld</tr>\n", "Other",
                             icmp6stat.icp6s_inhist[ICMP_SOURCEQUENCH]+                             
                             icmp6stat.icp6s_outhist[ICMP_ROUTERADVERT]+
                             icmp6stat.icp6s_outhist[ICMP_ROUTERSOLICIT]+
                             icmp6stat.icp6s_outhist[ICMP_TIMXCEED]+
                             icmp6stat.icp6s_outhist[ICMP_PARAMPROB]+
                             icmp6stat.icp6s_outhist[ICMP_TSTAMP]+
                             icmp6stat.icp6s_outhist[ICMP_TSTAMPREPLY]+
                             icmp6stat.icp6s_outhist[ICMP_IREQ]+
                             icmp6stat.icp6s_outhist[ICMP_IREQREPLY]+
                             icmp6stat.icp6s_outhist[ICMP_MASKREQ]+
                             icmp6stat.icp6s_outhist[ICMP_MASKREPLY]
                        );
                }
                html_table_end( client );
#endif
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             udpstat.udps_ipackets );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bad",
                             udpstat.udps_hdrops+
                             udpstat.udps_badsum+
                             udpstat.udps_badlen+
                             udpstat.udps_noport+
                             udpstat.udps_noportbcast+
                             udpstat.udps_fullsock
                        );
                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Total",
                             udpstat.udps_opackets );
                }
                html_table_end( client );

                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Connections" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Initiated",
                             tcpstat.tcps_connattempt );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Accepted",
                             tcpstat.tcps_accepts );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Established",
                             tcpstat.tcps_connects );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Closed",
                             tcpstat.tcps_closed );

                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Received" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Packets",
                             tcpstat.tcps_rcvtotal );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Data Packets",
                             tcpstat.tcps_rcvpack );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bytes",
                             tcpstat.tcps_rcvbyte );
                    
                    fprintf( client, "<tr><td><b>%s:</b><td></tr>\n", "Sent" );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Packets",
                             tcpstat.tcps_sndtotal );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Data Packets",
                             tcpstat.tcps_sndpack );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Bytes",
                             tcpstat.tcps_sndbyte );

                    
                }
                html_table_end( client );
                
                
            }
            html_table_row_end( client );

        }
        html_table_end( client );

        html_para_begin( client, "" );
        html_heading(client, 3, "Mbufs" );

        html_table_begin( client, "border" );
        {
            html_table_header( client, "Summary", "" );
            html_table_header( client, "Types", "" );

            html_table_row_begin( client, "" );
            {
                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Mbufs",
                             mbstat.m_mbufs );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Clusters",
                             mbstat.m_clusters );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Free Clusters",
                             mbstat.m_clfree );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Drops",
                             mbstat.m_drops );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Waits",
                             mbstat.m_wait );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Drains",
                             mbstat.m_drain );
#if defined(CYGPKG_NET_FREEBSD_STACK)
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Copy Fails",
                             mbstat.m_mcfail );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "Pullup Fails",
                             mbstat.m_mpfail );
#endif                    

                }
                html_table_end( client );

                html_table_data_begin( client, "valign=\"top\"" );                        
                html_table_begin( client, "" );
                {
                    u_long *mtypes;
#if defined(CYGPKG_NET_FREEBSD_STACK)
                    mtypes = mbtypes;
#else
                    mtypes = mbstat.m_mtypes;
#endif
                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "FREE",
                             mtypes[MT_FREE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "DATA",
                             mtypes[MT_DATA] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "HEADER",
                             mtypes[MT_HEADER] );
#if !defined(CYGPKG_NET_FREEBSD_STACK)                    
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SOCKET",
                             mtypes[MT_SOCKET] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "PCB",
                             mtypes[MT_PCB] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "RTABLE",
                             mtypes[MT_RTABLE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "HTABLE",
                             mtypes[MT_HTABLE] );
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "ATABLE",
                             mtypes[MT_ATABLE] );
#endif
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SONAME",
                             mtypes[MT_SONAME] );
#if !defined(CYGPKG_NET_FREEBSD_STACK)                                        
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "SOOPTS",
                             mtypes[MT_SOOPTS] );
#endif
                    fprintf( client, "<tr><td>%s<td>%ld</tr>\n", "FTABLE",
                             mtypes[MT_FTABLE] );

                    /* Ignore the rest for now... */
                    
                }
                html_table_end( client );
                
            }
            html_table_row_end( client );
            
        }
        html_table_end( client );
        
        
        draw_navbar(client);
    }
    html_body_end(client);

    html_end(client);
    
    freeifaddrs(iflist);
    return 1;
    
}

CYG_HTTPD_TABLE_ENTRY( cyg_monitor_network_entry,
                       "/monitor/network.htm*",
                       cyg_monitor_network,
                       NULL );

        
/* ================================================================= */
/* Instrumentation Monitor
 *
 * If the CYGPKG_KERNEL_INSTRUMENT option is set, we generate a table
 * showing the current instrumentation buffer. If the FLAGS option is
 * enabled we also print a table giving control of the flags.
 * 
 */

#ifdef CYGPKG_KERNEL_INSTRUMENT

/* Instrumentation record. */
struct Instrument_Record
{
    CYG_WORD16  type;                   // record type
    CYG_WORD16  thread;                 // current thread id
    CYG_WORD    timestamp;              // 32 bit timestamp
    CYG_WORD    arg1;                   // first arg
    CYG_WORD    arg2;                   // second arg
};
typedef struct Instrument_Record Instrument_Record;

/* Instrumentation variables, these live in the
 * instrumentation files in the kernel
 */
__externC Instrument_Record       *instrument_buffer_pointer;
__externC Instrument_Record       instrument_buffer[];
__externC cyg_uint32              instrument_buffer_size;

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)

static cyg_uint32 instrument_flags[(CYG_INSTRUMENT_CLASS_MAX>>8)+1];

#endif

static char cyg_monitor_instrument_blurb1[] =
"<p>Use the checkboxes to enable the events to be recorded. Click"
"the <em>Submit</em> button to start recording. Click the <em>Clear</em>"
"button to clear all instrumentation and to stop recording."
;

static cyg_bool cyg_monitor_instrument( FILE * client, char *filename,
                                        char *formdata, void *arg )
{

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)

    /* Disable all instrumentation while we generate the page.
     * Otherwise we could swamp the information we are really after.
     */
    
    cyg_scheduler_lock();
    {
        struct instrument_desc_s *id = instrument_desc;
        CYG_WORD cl = 0, ev = 0;

        for( ; id->msg != 0; id++ )
        {
            if( id->num > 0xff )
            {
                cl = id->num>>8;
                instrument_flags[cl] = 0;
            }
            else
            {
                ev = id->num;
                cyg_instrument_disable( cl<<8, ev );
            }
        }
    }
    cyg_scheduler_unlock();

#endif
    
    /* If we have some form data, deal with it.
     */
    if( formdata != NULL )
    {
        char *list[40];
        
        cyg_formdata_parse( formdata, list, sizeof(list)/sizeof(*list) );

#if defined(CYGDBG_KERNEL_INSTRUMENT_FLAGS) && \    defined(CYGDBG_KERNEL_INSTRUMENT_MSGS)
        
        if( cyg_formlist_find( list, "clear" ) != NULL )
        {
            /* If the clear button is set, then disable all instrumentation flags.
             */
            int i;
            for( i = 0; i < sizeof(instrument_flags)/sizeof(*instrument_flags); i++ )
                instrument_flags[i] = 0;
        }
        else
        {
            /* Otherwise all the set checkboxes have been reported to
             * us in the form of class=event inputs.
             */
            char **p;
            for( p = list; *p != NULL; p++ )
            {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -