#import <rpcsvc/rstat.h>

#import "RPCLoadView.h"
#import "NLoadCommon.h"

@implementation RPCLoadView : LoadView

extern int rstat(const char *, struct statstime *);

- initFrame:(const NXRect *) frameRect
{
	id result = [super initFrame:frameRect];
	
	update = getFloatDefault("RemoteUpdateSeconds");
	
	return result;
}

- loadAverage:(long *) vector loadScale:(int *) scale
{
	struct statstime stats;
	int i;
   
	if(rstat(hostName, &stats) != 0) return nil;

	for (i = 0; i < QUEUES; i++) vector[i] = stats.avenrun[i];
   
	*scale = FSCALE;
   
	return self;
}

@end
