mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 22:41:12 +01:00
ircd: hash: remove some detritus
This commit is contained in:
parent
d38c08c178
commit
cc6ce2d689
2 changed files with 0 additions and 67 deletions
|
@ -30,8 +30,6 @@
|
||||||
struct Dictionary;
|
struct Dictionary;
|
||||||
struct irc_radixtree;
|
struct irc_radixtree;
|
||||||
|
|
||||||
extern rb_dlink_list *hostTable;
|
|
||||||
|
|
||||||
extern struct Dictionary *nd_dict;
|
extern struct Dictionary *nd_dict;
|
||||||
extern struct irc_radixtree *resv_tree;
|
extern struct irc_radixtree *resv_tree;
|
||||||
extern struct irc_radixtree *channel_tree;
|
extern struct irc_radixtree *channel_tree;
|
||||||
|
@ -106,6 +104,4 @@ struct Client *find_cli_connid_hash(uint32_t connid);
|
||||||
void add_to_zconnid_hash(struct Client *client_p);
|
void add_to_zconnid_hash(struct Client *client_p);
|
||||||
void del_from_zconnid_hash(struct Client *client_p);
|
void del_from_zconnid_hash(struct Client *client_p);
|
||||||
|
|
||||||
extern void hash_stats(struct Client *);
|
|
||||||
|
|
||||||
#endif /* INCLUDED_hash_h */
|
#endif /* INCLUDED_hash_h */
|
||||||
|
|
63
ircd/hash.c
63
ircd/hash.c
|
@ -534,66 +534,3 @@ find_cli_connid_hash(uint32_t connid)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
output_hash(struct Client *source_p, const char *name, int length, int *counts, unsigned long deepest)
|
|
||||||
{
|
|
||||||
unsigned long total = 0;
|
|
||||||
int i;
|
|
||||||
char buf[128];
|
|
||||||
|
|
||||||
sendto_one_numeric(source_p, RPL_STATSDEBUG,
|
|
||||||
"B :%s Hash Statistics", name);
|
|
||||||
|
|
||||||
snprintf(buf, sizeof buf, "%.3f%%",
|
|
||||||
(float) ((counts[0]*100) / (float) length));
|
|
||||||
sendto_one_numeric(source_p, RPL_STATSDEBUG,
|
|
||||||
"B :Size: %d Empty: %d (%s)",
|
|
||||||
length, counts[0], buf);
|
|
||||||
|
|
||||||
for(i = 1; i < 11; i++)
|
|
||||||
{
|
|
||||||
total += (counts[i] * i);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dont want to divide by 0! --fl */
|
|
||||||
if(counts[0] != length)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof buf, "%.3f/%.3f",
|
|
||||||
(float) (total / (length - counts[0])),
|
|
||||||
(float) (total / length));
|
|
||||||
sendto_one_numeric(source_p, RPL_STATSDEBUG,
|
|
||||||
"B :Average depth: %s Highest depth: %lu",
|
|
||||||
buf, deepest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
count_hash(struct Client *source_p, rb_dlink_list *table, int length, const char *name)
|
|
||||||
{
|
|
||||||
int counts[11];
|
|
||||||
unsigned long deepest = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
memset(counts, 0, sizeof(counts));
|
|
||||||
|
|
||||||
for(i = 0; i < length; i++)
|
|
||||||
{
|
|
||||||
if(rb_dlink_list_length(&table[i]) >= 10)
|
|
||||||
counts[10]++;
|
|
||||||
else
|
|
||||||
counts[rb_dlink_list_length(&table[i])]++;
|
|
||||||
|
|
||||||
if(rb_dlink_list_length(&table[i]) > deepest)
|
|
||||||
deepest = rb_dlink_list_length(&table[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
output_hash(source_p, name, length, counts, deepest);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
hash_stats(struct Client *source_p)
|
|
||||||
{
|
|
||||||
count_hash(source_p, hostTable, HOST_MAX, "Hostname");
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue