You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Harrie Hazewinkel <ha...@covalent.net> on 2001/06/28 00:07:54 UTC

[PATCH] easy scoreboard access

HI,

Attached patch will put two functions in the core
via which a worker_score or server_score can be
retrieved from the scoreboard.

Both functions have depending on the dimensions of the array
have 1 or 2 integers as parameters. Those indicate the
array index of the struct to be returned. Within the
function it also check whether the indexes asked are within
the range allowed.

Harrie

PS: Based upon an idea of Jon Travis.
-- 
address: Covalent Technologies, 645 Howard St, San Francisco, CA - 94105
phone: +1-415-536-5221                               fax:+1-415-536-5210
personal website: http://www.lisanza.net/

Re: [PATCH] easy scoreboard access

Posted by Harrie Hazewinkel <ha...@covalent.net>.
"Paul J. Reder" wrote:
> 
> Isn't this logic backwards? Have I just not had enough sugar yet this morning?

Hmm, yeah, maybe I did not had enough yesterday.
I wanted to make it the OR instead of AND, since that could potentially
be faster evaulated (if a compiler can handle it).

I had intended:
> +    if (((x < 0) || (hard_server_limit < x)) ||
> +        ((y < 0) || (hard_thread_limit < y))) {
> +        return(NULL); /* Out of range */
> +    }
> +    return(&ap_scoreboard_image->servers[x][y]);

I wil redo the patch.


Harrie
-- 
address: Covalent Technologies, 645 Howard St, San Francisco, CA - 94105
phone: +1-415-536-5221                               fax:+1-415-536-5210
personal website: http://www.lisanza.net/

Re: [PATCH] easy scoreboard access

Posted by "Paul J. Reder" <re...@raleigh.ibm.com>.
Isn't this logic backwards? Have I just not had enough sugar yet this morning?

+worker_score *ap_get_servers_scoreboard(int x, int y)
+{
+int hard_server_limit;
+int hard_thread_limit;
+
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &hard_server_limit);
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &hard_thread_limit);
+
+    if (((x < 0) || (hard_server_limit < x)) &&
+        ((y < 0) || (hard_thread_limit < y))) {
+        return(&ap_scoreboard_image->servers[x][y]);
+    }
+    return(NULL);
+}

Shouldn't it be something more like:

+worker_score *ap_get_servers_scoreboard(int x, int y)
+{
+int hard_server_limit;
+int hard_thread_limit;
+
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &hard_server_limit);
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &hard_thread_limit);
+
+    if ((x > 0) && (x < hard_server_limit) &&
+        (y > 0) && (y < hard_thread_limit)) {
+        return(&ap_scoreboard_image->servers[x][y]);
+    }
+    return(NULL);
+}

I'm going to go get more sugar now, maybe it'll look different in a bit.

-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein