use generated jfieldId cache/setter for NetStat

This commit is contained in:
Doug MacEachern 2006-07-10 21:54:57 +00:00
parent 001ed4238d
commit b471945fbd
2 changed files with 12 additions and 7 deletions

View File

@ -818,6 +818,15 @@ my %classes = (
plat => 'LFS' plat => 'LFS'
}, },
], ],
#only for jfieldId cache/setters
NetStat => [
{
name => 'tcp_inbound_total', type => 'Int',
},
{
name => 'tcp_outbound_total', type => 'Int',
},
],
ResourceLimit => [ ResourceLimit => [
{ {
name => 'cpu_cur', name => 'cpu_cur',
@ -1202,8 +1211,8 @@ EOF
my %has_name_arg = map { $_, 1 } qw(FileSystemUsage FileAttrs DirStat DirUsage my %has_name_arg = map { $_, 1 } qw(FileSystemUsage FileAttrs DirStat DirUsage
NetInterfaceConfig NetInterfaceStat); NetInterfaceConfig NetInterfaceStat);
my %proc_no_arg = map { $_, 1 } qw(stat); my %proc_no_arg = map { $_, 1 } qw(stat);
my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection who my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection net_stat
cpu_info file_system); #list funcs only who cpu_info file_system); #list funcs only
my %field_cache; my %field_cache;
my $i = 0; my $i = 0;

View File

@ -843,11 +843,7 @@ JNIEXPORT void SIGAR_JNI(NetStat_nstat)
cls = JENV->GetObjectClass(env, obj); cls = JENV->GetObjectClass(env, obj);
id = JENV->GetFieldID(env, cls, "tcpInboundTotal", "I"); JAVA_SIGAR_SET_FIELDS_NETSTAT(cls, obj, netstat);
JENV->SetIntField(env, obj, id, netstat.tcp_inbound_total);
id = JENV->GetFieldID(env, cls, "tcpOutboundTotal", "I");
JENV->SetIntField(env, obj, id, netstat.tcp_outbound_total);
if (sizeof(tcp_states[0]) == sizeof(netstat.tcp_states[0])) { if (sizeof(tcp_states[0]) == sizeof(netstat.tcp_states[0])) {
memcpy(&tcp_states[0], &netstat.tcp_states[0], memcpy(&tcp_states[0], &netstat.tcp_states[0],