ATTRIBUTE FreeRADIUS-Server-EMA-USEC-Window-1 179 integer
ATTRIBUTE FreeRADIUS-Server-EMA-USEC-Window-10 180 integer
+ATTRIBUTE FreeRADIUS-Queue-PPS-In 181 integer
+ATTRIBUTE FreeRADIUS-Queue-PPS-Out 182 integer
+
END-VENDOR FreeRADIUS
extern int total_active_threads(void);
extern void thread_pool_lock(void);
extern void thread_pool_unlock(void);
-extern void thread_pool_queue_stats(int *array);
+extern void thread_pool_queue_stats(int array[RAD_LISTEN_MAX], int pps[2]);
#ifndef HAVE_PTHREAD_H
#define rad_fork(n) fork()
if (vp) vp->vp_date = hup_time.tv_sec;
#ifdef HAVE_PTHREAD_H
- int i, array[RAD_LISTEN_MAX];
+ int i, array[RAD_LISTEN_MAX], pps[2];
- thread_pool_queue_stats(array);
+ thread_pool_queue_stats(array, pps);
-#ifdef WITH_DETAIL
- for (i = 0; i <= RAD_LISTEN_DETAIL; i++) {
+ for (i = 0; i <= 4; i++) {
vp = radius_paircreate(request, &request->reply->vps,
162 + i, VENDORPEC_FREERADIUS,
PW_TYPE_INTEGER);
if (!vp) continue;
vp->vp_integer = array[i];
}
-#endif
+
+ for (i = 0; i < 2; i++) {
+ vp = radius_paircreate(request, &request->reply->vps,
+ 180 + i, VENDORPEC_FREERADIUS,
+ PW_TYPE_INTEGER);
+
+ if (!vp) continue;
+ vp->vp_integer = pps[i];
+ }
#endif
}
*/
#endif
-void thread_pool_queue_stats(int *array)
+void thread_pool_queue_stats(int array[RAD_LISTEN_MAX], int pps[2])
{
int i;
#ifndef WITH_GCD
if (pool_initialized) {
+ struct timeval now;
+
for (i = 0; i < RAD_LISTEN_MAX; i++) {
array[i] = fr_fifo_num_elements(thread_pool.fifo[i]);
}
+
+ gettimeofday(&now, NULL);
+
+ pps[0] = rad_pps(&thread_pool.pps_in.pps_old,
+ &thread_pool.pps_in.pps_now,
+ &thread_pool.pps_in.time_old,
+ &now);
+ pps[1] = rad_pps(&thread_pool.pps_out.pps_old,
+ &thread_pool.pps_out.pps_now,
+ &thread_pool.pps_out.time_old,
+ &now);
+
} else
#endif /* WITH_GCD */
{
for (i = 0; i < RAD_LISTEN_MAX; i++) {
array[i] = 0;
}
+
+ pps[0] = pps[1] = 0;
}
}
#endif /* HAVE_PTHREAD_H */