#include "copyright.h"#include "autoconf.h"#include "config.h"#include "externs.h"#include <signal.h>#include "attrs.h"#include "command.h"#include "interface.h"#include "powers.h"Include dependency graph for cque.cpp:

Go to the source code of this file.
Functions | |
| static CLinearTimeDelta | GetProcessorUsage (void) |
| static int | add_to (dbref executor, int am, int attrnum) |
| static void | Task_RunQueueEntry (void *pEntry, int iUnused) |
| static bool | que_want (BQUE *entry, dbref ptarg, dbref otarg) |
| static void | Task_SemaphoreTimeout (void *pExpired, int iUnused) |
| static int | CallBack_HaltQueue (PTASK_RECORD p) |
| int | halt_que (dbref executor, dbref object) |
| void | do_halt (dbref executor, dbref caller, dbref enactor, int key, char *target) |
| static int | CallBack_NotifySemaphoreDrainOrAll (PTASK_RECORD p) |
| static int | CallBack_NotifySemaphoreFirstOrQuiet (PTASK_RECORD p) |
| int | nfy_que (dbref sem, int attr, int key, int count) |
| void | do_notify (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *what, char *count) |
| static BQUE * | setup_que (dbref executor, dbref caller, dbref enactor, char *command, char *args[], int nargs, char *sargs[]) |
| void | wait_que (dbref executor, dbref caller, dbref enactor, bool bTimed, CLinearTimeAbsolute <aWhen, dbref sem, int attr, char *command, char *args[], int nargs, char *sargs[]) |
| void | do_wait (dbref executor, dbref caller, dbref enactor, int key, char *event, char *cmd, char *cargs[], int ncargs) |
| static int | CallBack_ShowDispatches (PTASK_RECORD p) |
| static void | ShowPsLine (BQUE *tmp) |
| static int | CallBack_ShowWait (PTASK_RECORD p) |
| static int | CallBack_ShowSemaphore (PTASK_RECORD p) |
| void | do_ps (dbref executor, dbref caller, dbref enactor, int key, char *target) |
| static int | CallBack_Warp (PTASK_RECORD p) |
| void | do_queue (dbref executor, dbref caller, dbref enactor, int key, char *arg) |
Variables | |
| bool | break_called = false |
| static dbref | Halt_Player_Target |
| static dbref | Halt_Object_Target |
| static int | Halt_Entries |
| static dbref | Halt_Player_Run |
| static dbref | Halt_Entries_Run |
| static int | Notify_Key |
| static int | Notify_Num_Done |
| static int | Notify_Num_Max |
| static int | Notify_Sem |
| static int | Notify_Attr |
| static CLinearTimeAbsolute | Show_lsaNow |
| static int | Total_SystemTasks |
| static int | Total_RunQueueEntry |
| static int | Shown_RunQueueEntry |
| static int | Total_SemaphoreTimeout |
| static int | Shown_SemaphoreTimeout |
| static dbref | Show_Player_Target |
| static dbref | Show_Object_Target |
| static int | Show_Key |
| static dbref | Show_Player |
| static int | Show_bFirstLine |
| static CLinearTimeDelta | ltdWarp |
| static int add_to | ( | dbref | executor, | |
| int | am, | |||
| int | attrnum | |||
| ) | [static] |
Definition at line 62 of file cque.cpp.
References atr_add_raw_LEN(), atr_get, free_lbuf, mux_atol(), and mux_ltoa().
Referenced by CallBack_HaltQueue(), do_wait(), nfy_que(), and Task_SemaphoreTimeout().
00063 { 00064 int aflags; 00065 dbref aowner; 00066 00067 char *atr_gotten = atr_get(executor, attrnum, &aowner, &aflags); 00068 int num = mux_atol(atr_gotten); 00069 free_lbuf(atr_gotten); 00070 num += am; 00071 00072 char buff[20]; 00073 int nlen = 0; 00074 *buff = '\0'; 00075 if (num) 00076 { 00077 nlen = mux_ltoa(num, buff); 00078 } 00079 atr_add_raw_LEN(executor, attrnum, buff, nlen); 00080 return num; 00081 }
| static int CallBack_HaltQueue | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 279 of file cque.cpp.
References a_Queue(), add_to(), TASK_RECORD::arg_voidptr, bque::attr, bque::executor, TASK_RECORD::fpTask, free_qentry, giveto(), Halt_Entries, Halt_Entries_Run, Halt_Object_Target, Halt_Player_Run, Halt_Player_Target, isPlayer, IU_NEXT_TASK, IU_REMOVE_TASK, MEMFREE, mudconf, NOTHING, Owner, que_want(), bque::sem, Task_RunQueueEntry(), Task_SemaphoreTimeout(), bque::text, and confdata::waitcost.
Referenced by halt_que().
00280 { 00281 if ( p->fpTask == Task_RunQueueEntry 00282 #ifdef QUERY_SLAVE 00283 || p->fpTask == Task_SQLTimeout 00284 #endif // QUERY_SLAVE 00285 || p->fpTask == Task_SemaphoreTimeout) 00286 { 00287 // This is a @wait, timed Semaphore Task, or timed SQL Query. 00288 // 00289 BQUE *point = (BQUE *)(p->arg_voidptr); 00290 if (que_want(point, Halt_Player_Target, Halt_Object_Target)) 00291 { 00292 // Accounting for pennies and queue quota. 00293 // 00294 dbref dbOwner = point->executor; 00295 if (!isPlayer(dbOwner)) 00296 { 00297 dbOwner = Owner(dbOwner); 00298 } 00299 if (dbOwner != Halt_Player_Run) 00300 { 00301 if (Halt_Player_Run != NOTHING) 00302 { 00303 giveto(Halt_Player_Run, mudconf.waitcost * Halt_Entries_Run); 00304 a_Queue(Halt_Player_Run, -Halt_Entries_Run); 00305 } 00306 Halt_Player_Run = dbOwner; 00307 Halt_Entries_Run = 0; 00308 } 00309 Halt_Entries++; 00310 Halt_Entries_Run++; 00311 if (p->fpTask == Task_SemaphoreTimeout) 00312 { 00313 add_to(point->sem, -1, point->attr); 00314 } 00315 MEMFREE(point->text); 00316 point->text = NULL; 00317 free_qentry(point); 00318 return IU_REMOVE_TASK; 00319 } 00320 } 00321 return IU_NEXT_TASK; 00322 }
| static int CallBack_NotifySemaphoreDrainOrAll | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 435 of file cque.cpp.
References a_Queue(), TASK_RECORD::arg_voidptr, bque::attr, bque::enactor, bque::executor, TASK_RECORD::fpTask, free_qentry, CLinearTimeAbsolute::GetUTC(), giveto(), TASK_RECORD::iPriority, isPlayer, IU_NEXT_TASK, IU_REMOVE_TASK, IU_UPDATE_TASK, TASK_RECORD::ltaWhen, MEMFREE, mudconf, NFY_DRAIN, Notify_Attr, Notify_Key, Notify_Num_Done, Notify_Sem, Owner, PRIORITY_OBJECT, PRIORITY_PLAYER, bque::sem, Task_RunQueueEntry(), Task_SemaphoreTimeout(), bque::text, and confdata::waitcost.
Referenced by nfy_que().
00436 { 00437 if (p->fpTask == Task_SemaphoreTimeout) 00438 { 00439 // This represents a semaphore. 00440 // 00441 BQUE *point = (BQUE *)(p->arg_voidptr); 00442 if ( point->sem == Notify_Sem 00443 && ( point->attr == Notify_Attr 00444 || !Notify_Attr)) 00445 { 00446 Notify_Num_Done++; 00447 if (Notify_Key == NFY_DRAIN) 00448 { 00449 // Discard the command 00450 // 00451 giveto(point->executor, mudconf.waitcost); 00452 a_Queue(Owner(point->executor), -1); 00453 MEMFREE(point->text); 00454 point->text = NULL; 00455 free_qentry(point); 00456 return IU_REMOVE_TASK; 00457 } 00458 else 00459 { 00460 // Allow the command to run. The priority may have been 00461 // PRIORITY_SUSPEND, so we need to change it. 00462 // 00463 if (isPlayer(point->enactor)) 00464 { 00465 p->iPriority = PRIORITY_PLAYER; 00466 } 00467 else 00468 { 00469 p->iPriority = PRIORITY_OBJECT; 00470 } 00471 p->ltaWhen.GetUTC(); 00472 p->fpTask = Task_RunQueueEntry; 00473 return IU_UPDATE_TASK; 00474 } 00475 } 00476 } 00477 return IU_NEXT_TASK; 00478 }
| static int CallBack_NotifySemaphoreFirstOrQuiet | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 482 of file cque.cpp.
References TASK_RECORD::arg_voidptr, bque::attr, bque::enactor, TASK_RECORD::fpTask, CLinearTimeAbsolute::GetUTC(), TASK_RECORD::iPriority, isPlayer, IU_DONE, IU_NEXT_TASK, IU_UPDATE_TASK, TASK_RECORD::ltaWhen, NFY_NFY, Notify_Attr, Notify_Key, Notify_Num_Done, Notify_Num_Max, Notify_Sem, PRIORITY_OBJECT, PRIORITY_PLAYER, bque::sem, Task_RunQueueEntry(), and Task_SemaphoreTimeout().
Referenced by nfy_que().
00483 { 00484 // If we've notified enough, exit. 00485 // 00486 if ( Notify_Key == NFY_NFY 00487 && Notify_Num_Done >= Notify_Num_Max) 00488 { 00489 return IU_DONE; 00490 } 00491 00492 if (p->fpTask == Task_SemaphoreTimeout) 00493 { 00494 // This represents a semaphore. 00495 // 00496 BQUE *point = (BQUE *)(p->arg_voidptr); 00497 if ( point->sem == Notify_Sem 00498 && ( point->attr == Notify_Attr 00499 || !Notify_Attr)) 00500 { 00501 Notify_Num_Done++; 00502 00503 // Allow the command to run. The priority may have been 00504 // PRIORITY_SUSPEND, so we need to change it. 00505 // 00506 if (isPlayer(point->enactor)) 00507 { 00508 p->iPriority = PRIORITY_PLAYER; 00509 } 00510 else 00511 { 00512 p->iPriority = PRIORITY_OBJECT; 00513 } 00514 p->ltaWhen.GetUTC(); 00515 p->fpTask = Task_RunQueueEntry; 00516 return IU_UPDATE_TASK; 00517 } 00518 } 00519 return IU_NEXT_TASK; 00520 }
| static int CallBack_ShowDispatches | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 1106 of file cque.cpp.
References dispatch_CacheTick(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), TASK_RECORD::fpTask, IU_NEXT_TASK, TASK_RECORD::ltaWhen, notify, CLinearTimeDelta::ReturnSeconds(), Show_lsaNow, Task_ProcessCommand(), and tprintf().
Referenced by do_ps().
01107 { 01108 Total_SystemTasks++; 01109 CLinearTimeDelta ltd = p->ltaWhen - Show_lsaNow; 01110 if (p->fpTask == dispatch_DatabaseDump) 01111 { 01112 notify(Show_Player, tprintf("[%d]auto-@dump", ltd.ReturnSeconds())); 01113 } 01114 else if (p->fpTask == dispatch_FreeListReconstruction) 01115 { 01116 notify(Show_Player, tprintf("[%d]auto-@dbck", ltd.ReturnSeconds())); 01117 } 01118 else if (p->fpTask == dispatch_IdleCheck) 01119 { 01120 notify(Show_Player, tprintf("[%d]Check for idle players", ltd.ReturnSeconds())); 01121 } 01122 else if (p->fpTask == dispatch_CheckEvents) 01123 { 01124 notify(Show_Player, tprintf("[%d]Test for @daily time", ltd.ReturnSeconds())); 01125 } 01126 #ifndef MEMORY_BASED 01127 else if (p->fpTask == dispatch_CacheTick) 01128 { 01129 notify(Show_Player, tprintf("[%d]Database cache tick", ltd.ReturnSeconds())); 01130 } 01131 #endif 01132 else if (p->fpTask == Task_ProcessCommand) 01133 { 01134 notify(Show_Player, tprintf("[%d]Further command quota", ltd.ReturnSeconds())); 01135 } 01136 #ifdef WIN32 01137 else if (p->fpTask == Task_FreeDescriptor) 01138 { 01139 notify(Show_Player, tprintf("[%d]Delayed descriptor deallocation", ltd.ReturnSeconds())); 01140 } 01141 else if (p->fpTask == Task_DeferredClose) 01142 { 01143 notify(Show_Player, tprintf("[%d]Delayed socket close", ltd.ReturnSeconds())); 01144 } 01145 #endif 01146 else 01147 { 01148 Total_SystemTasks--; 01149 } 01150 return IU_NEXT_TASK; 01151 }
| static int CallBack_ShowSemaphore | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 1222 of file cque.cpp.
References TASK_RECORD::arg_voidptr, TASK_RECORD::fpTask, IU_NEXT_TASK, notify, PS_SUMM, que_want(), Show_bFirstLine, Show_Key, Show_Object_Target, Show_Player, Show_Player_Target, Shown_SemaphoreTimeout, ShowPsLine(), Task_SemaphoreTimeout(), and Total_SemaphoreTimeout.
Referenced by do_ps().
01223 { 01224 if (p->fpTask != Task_SemaphoreTimeout) 01225 { 01226 return IU_NEXT_TASK; 01227 } 01228 01229 Total_SemaphoreTimeout++; 01230 BQUE *tmp = (BQUE *)(p->arg_voidptr); 01231 if (que_want(tmp, Show_Player_Target, Show_Object_Target)) 01232 { 01233 Shown_SemaphoreTimeout++; 01234 if (Show_Key == PS_SUMM) 01235 { 01236 return IU_NEXT_TASK; 01237 } 01238 if (Show_bFirstLine) 01239 { 01240 notify(Show_Player, "----- Semaphore Queue -----"); 01241 Show_bFirstLine = false; 01242 } 01243 ShowPsLine(tmp); 01244 } 01245 return IU_NEXT_TASK; 01246 }
| static int CallBack_ShowWait | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 1196 of file cque.cpp.
References TASK_RECORD::arg_voidptr, TASK_RECORD::fpTask, IU_NEXT_TASK, notify, PS_SUMM, que_want(), Show_bFirstLine, Show_Key, Show_Object_Target, Show_Player, Show_Player_Target, Shown_RunQueueEntry, ShowPsLine(), Task_RunQueueEntry(), and Total_RunQueueEntry.
Referenced by do_ps().
01197 { 01198 if (p->fpTask != Task_RunQueueEntry) 01199 { 01200 return IU_NEXT_TASK; 01201 } 01202 01203 Total_RunQueueEntry++; 01204 BQUE *tmp = (BQUE *)(p->arg_voidptr); 01205 if (que_want(tmp, Show_Player_Target, Show_Object_Target)) 01206 { 01207 Shown_RunQueueEntry++; 01208 if (Show_Key == PS_SUMM) 01209 { 01210 return IU_NEXT_TASK; 01211 } 01212 if (Show_bFirstLine) 01213 { 01214 notify(Show_Player, "----- Wait Queue -----"); 01215 Show_bFirstLine = false; 01216 } 01217 ShowPsLine(tmp); 01218 } 01219 return IU_NEXT_TASK; 01220 }
| static int CallBack_Warp | ( | PTASK_RECORD | p | ) | [static] |
Definition at line 1390 of file cque.cpp.
References TASK_RECORD::arg_voidptr, TASK_RECORD::fpTask, bque::IsTimed, IU_NEXT_TASK, IU_UPDATE_TASK, TASK_RECORD::ltaWhen, ltdWarp, Task_RunQueueEntry(), Task_SemaphoreTimeout(), and bque::waittime.
Referenced by do_queue().
01391 { 01392 if ( p->fpTask == Task_RunQueueEntry 01393 #ifdef QUERY_SLAVE 01394 || p->fpTask == Task_SQLTimeout 01395 #endif // QUERY_SLAVE 01396 || p->fpTask == Task_SemaphoreTimeout) 01397 { 01398 BQUE *point = (BQUE *)(p->arg_voidptr); 01399 if (point->IsTimed) 01400 { 01401 point->waittime -= ltdWarp; 01402 p->ltaWhen -= ltdWarp; 01403 return IU_UPDATE_TASK; 01404 } 01405 } 01406 return IU_NEXT_TASK; 01407 }
Definition at line 358 of file cque.cpp.
References Can_Halt, Good_obj, HALT_ALL, halt_que(), isPlayer, match_controlled, match_thing(), NOPERM_MESSAGE, NOTHING, notify, Owner, Quiet, tprintf(), and UNUSED_PARAMETER.
00359 { 00360 UNUSED_PARAMETER(caller); 00361 UNUSED_PARAMETER(enactor); 00362 00363 dbref executor_targ, obj_targ; 00364 00365 if ((key & HALT_ALL) && !Can_Halt(executor)) 00366 { 00367 notify(executor, NOPERM_MESSAGE); 00368 return; 00369 } 00370 00371 // Figure out what to halt. 00372 // 00373 if (!target || !*target) 00374 { 00375 obj_targ = NOTHING; 00376 if (key & HALT_ALL) 00377 { 00378 executor_targ = NOTHING; 00379 } 00380 else 00381 { 00382 executor_targ = Owner(executor); 00383 if (!isPlayer(executor)) 00384 { 00385 obj_targ = executor; 00386 } 00387 } 00388 } 00389 else 00390 { 00391 if (Can_Halt(executor)) 00392 { 00393 obj_targ = match_thing(executor, target); 00394 } 00395 else 00396 { 00397 obj_targ = match_controlled(executor, target); 00398 } 00399 if (!Good_obj(obj_targ)) 00400 { 00401 return; 00402 } 00403 if (key & HALT_ALL) 00404 { 00405 notify(executor, "Can't specify a target and /all"); 00406 return; 00407 } 00408 if (isPlayer(obj_targ)) 00409 { 00410 executor_targ = obj_targ; 00411 obj_targ = NOTHING; 00412 } 00413 else 00414 { 00415 executor_targ = NOTHING; 00416 } 00417 } 00418 00419 int numhalted = halt_que(executor_targ, obj_targ); 00420 if (Quiet(executor)) 00421 { 00422 return; 00423 } 00424 notify(Owner(executor), tprintf("%d queue entr%s removed.", numhalted, numhalted == 1 ? "y" : "ies")); 00425 }
| void do_notify | ( | dbref | executor, | |
| dbref | caller, | |||
| dbref | enactor, | |||
| int | key, | |||
| int | nargs, | |||
| char * | what, | |||
| char * | count | |||
| ) |
Definition at line 573 of file cque.cpp.
References A_SEMAPHORE, anum_get, bCanSetAttr(), Controls, Good_obj, init_match(), Link_ok, match_everything(), mkattr(), mux_atol(), NFY_DRAIN, nfy_que(), NFY_QUIET, noisy_match_result(), NOPERM_MESSAGE, notify, notify_quiet, NOTYPE, parse_to(), Quiet, and UNUSED_PARAMETER.
00582 { 00583 UNUSED_PARAMETER(caller); 00584 UNUSED_PARAMETER(enactor); 00585 UNUSED_PARAMETER(nargs); 00586 00587 char *obj = parse_to(&what, '/', 0); 00588 init_match(executor, obj, NOTYPE); 00589 match_everything(0); 00590 00591 dbref thing = noisy_match_result(); 00592 if (!Good_obj(thing)) 00593 { 00594 return; 00595 } 00596 if (!Controls(executor, thing) && !Link_ok(thing)) 00597 { 00598 notify(executor, NOPERM_MESSAGE); 00599 } 00600 else 00601 { 00602 int atr = A_SEMAPHORE; 00603 if ( what 00604 && what[0] != '\0') 00605 { 00606 int i = mkattr(executor, what); 00607 if (0 < i) 00608 { 00609 atr = i; 00610 if (atr != A_SEMAPHORE) 00611 { 00612 // Do they have permission to set this attribute? 00613 // 00614 ATTR *ap = (ATTR *)anum_get(atr); 00615 if (!bCanSetAttr(executor, thing, ap)) 00616 { 00617 notify_quiet(executor, NOPERM_MESSAGE); 00618 return; 00619 } 00620 } 00621 } 00622 } 00623 00624 int loccount; 00625 if ( count 00626 && count[0] != '\0') 00627 { 00628 loccount = mux_atol(count); 00629 } 00630 else 00631 { 00632 loccount = 1; 00633 } 00634 if (loccount > 0) 00635 { 00636 nfy_que(thing, atr, key, loccount); 00637 if ( (!(Quiet(executor) || Quiet(thing))) 00638 && key != NFY_QUIET) 00639 { 00640 if (key == NFY_DRAIN) 00641 { 00642 notify_quiet(executor, "Drained."); 00643 } 00644 else 00645 { 00646 notify_quiet(executor, "Notified."); 00647 } 00648 } 00649 } 00650 } 00651 }
Definition at line 1279 of file cque.cpp.
References alloc_mbuf, CallBack_ShowDispatches(), CallBack_ShowSemaphore(), CallBack_ShowWait(), free_mbuf, CLinearTimeAbsolute::GetUTC(), isPlayer, match_controlled, NOPERM_MESSAGE, NOTHING, notify, Owner, PS_ALL, PS_BRIEF, PS_LONG, PS_SUMM, scheduler, See_Queue, Show_bFirstLine, Show_Key, Show_lsaNow, Show_Object_Target, Show_Player, Show_Player_Target, Shown_RunQueueEntry, Shown_SemaphoreTimeout, Total_RunQueueEntry, Total_SemaphoreTimeout, Total_SystemTasks, CScheduler::TraverseOrdered(), UNUSED_PARAMETER, and Wizard.
01280 { 01281 UNUSED_PARAMETER(caller); 01282 UNUSED_PARAMETER(enactor); 01283 01284 char *bufp; 01285 dbref executor_targ, obj_targ; 01286 01287 // Figure out what to list the queue for. 01288 // 01289 if ((key & PS_ALL) && !See_Queue(executor)) 01290 { 01291 notify(executor, NOPERM_MESSAGE); 01292 return; 01293 } 01294 if (!target || !*target) 01295 { 01296 obj_targ = NOTHING; 01297 if (key & PS_ALL) 01298 { 01299 executor_targ = NOTHING; 01300 } 01301 else 01302 { 01303 executor_targ = Owner(executor); 01304 if (!isPlayer(executor)) 01305 { 01306 obj_targ = executor; 01307 } 01308 } 01309 } 01310 else 01311 { 01312 executor_targ = Owner(executor); 01313 obj_targ = match_controlled(executor, target); 01314 if (obj_targ == NOTHING) 01315 { 01316 return; 01317 } 01318 if (key & PS_ALL) 01319 { 01320 notify(executor, "Can't specify a target and /all"); 01321 return; 01322 } 01323 if (isPlayer(obj_targ)) 01324 { 01325 executor_targ = obj_targ; 01326 obj_targ = NOTHING; 01327 } 01328 } 01329 key = key & ~PS_ALL; 01330 01331 switch (key) 01332 { 01333 case PS_BRIEF: 01334 case PS_SUMM: 01335 case PS_LONG: 01336 break; 01337 01338 default: 01339 notify(executor, "Illegal combination of switches."); 01340 return; 01341 } 01342 01343 Show_lsaNow.GetUTC(); 01344 Total_SystemTasks = 0; 01345 Total_RunQueueEntry = 0; 01346 Shown_RunQueueEntry = 0; 01347 Total_SemaphoreTimeout = 0; 01348 Shown_SemaphoreTimeout = 0; 01349 Show_Player_Target = executor_targ; 01350 Show_Object_Target = obj_targ; 01351 Show_Key = key; 01352 Show_Player = executor; 01353 Show_bFirstLine = true; 01354 scheduler.TraverseOrdered(CallBack_ShowWait); 01355 Show_bFirstLine = true; 01356 scheduler.TraverseOrdered(CallBack_ShowSemaphore); 01357 #ifdef QUERY_SLAVE 01358 Show_bFirstLine = true; 01359 scheduler.TraverseOrdered(CallBack_ShowSQLQueries); 01360 #endif // QUERY_SLAVE 01361 if (Wizard(executor)) 01362 { 01363 notify(executor, "----- System Queue -----"); 01364 scheduler.TraverseOrdered(CallBack_ShowDispatches); 01365 } 01366 01367 // Display stats. 01368 // 01369 bufp = alloc_mbuf("do_ps"); 01370 #ifdef QUERY_SLAVE 01371 sprintf(bufp, "Totals: Wait Queue...%d/%d Semaphores...%d/%d SQL %d/%d", 01372 Shown_RunQueueEntry, Total_RunQueueEntry, 01373 Shown_SemaphoreTimeout, Total_SemaphoreTimeout, 01374 Shown_SQLTimeout, Total_SQLTimeout); 01375 #else 01376 sprintf(bufp, "Totals: Wait Queue...%d/%d Semaphores...%d/%d", 01377 Shown_RunQueueEntry, Total_RunQueueEntry, 01378 Shown_SemaphoreTimeout, Total_SemaphoreTimeout); 01379 #endif // QUERY_SLAVE 01380 notify(executor, bufp); 01381 if (Wizard(executor)) 01382 { 01383 sprintf(bufp, " System Tasks.....%d", Total_SystemTasks); 01384 notify(executor, bufp); 01385 } 01386 free_mbuf(bufp); 01387 }
Definition at line 1412 of file cque.cpp.
References CallBack_Warp(), CScheduler::GetMinPriority(), CLinearTimeAbsolute::GetUTC(), ltdWarp, mux_atol(), notify, PRIORITY_CF_DEQUEUE_DISABLED, PRIORITY_CF_DEQUEUE_ENABLED, QUEUE_KICK, QUEUE_WARP, Quiet, CScheduler::ReadyTasks(), CScheduler::RunTasks(), scheduler, CScheduler::SetMinPriority(), CLinearTimeDelta::SetSeconds(), tprintf(), CScheduler::TraverseUnordered(), and UNUSED_PARAMETER.
Referenced by do_timewarp().
01413 { 01414 UNUSED_PARAMETER(caller); 01415 UNUSED_PARAMETER(enactor); 01416 01417 if (key == QUEUE_KICK) 01418 { 01419 int i = mux_atol(arg); 01420 int save_minPriority = scheduler.GetMinPriority(); 01421 if (save_minPriority <= PRIORITY_CF_DEQUEUE_DISABLED) 01422 { 01423 notify(executor, "Warning: automatic dequeueing is disabled."); 01424 scheduler.SetMinPriority(PRIORITY_CF_DEQUEUE_ENABLED); 01425 } 01426 CLinearTimeAbsolute lsaNow; 01427 lsaNow.GetUTC(); 01428 scheduler.ReadyTasks(lsaNow); 01429 int ncmds = scheduler.RunTasks(i); 01430 scheduler.SetMinPriority(save_minPriority); 01431 01432 if (!Quiet(executor)) 01433 { 01434 notify(executor, tprintf("%d commands processed.", ncmds)); 01435 } 01436 } 01437 else if (key == QUEUE_WARP) 01438 { 01439 int iWarp = mux_atol(arg); 01440 ltdWarp.SetSeconds(iWarp); 01441 if (scheduler.GetMinPriority() <= PRIORITY_CF_DEQUEUE_DISABLED) 01442 { 01443 notify(executor, "Warning: automatic dequeueing is disabled."); 01444 } 01445 01446 scheduler.TraverseUnordered(CallBack_Warp); 01447 01448 if (Quiet(executor)) 01449 { 01450 return; 01451 } 01452 if (iWarp > 0) 01453 { 01454 notify(executor, tprintf("WaitQ timer advanced %d seconds.", iWarp)); 01455 } 01456 else if (iWarp < 0) 01457 { 01458 notify(executor, tprintf("WaitQ timer set back %d seconds.", iWarp)); 01459 } 01460 else 01461 { 01462 notify(executor, "Object queue appended to player queue."); 01463 } 01464 } 01465 }
| void do_wait | ( | dbref | executor, | |
| dbref | caller, | |||
| dbref | enactor, | |||
| int | key, | |||
| char * | event, | |||
| char * | cmd, | |||
| char * | cargs[], | |||
| int | ncargs | |||
| ) |
Definition at line 925 of file cque.cpp.
References A_SEMAPHORE, add_to(), atr_num(), atr_str(), bCanSetAttr(), Controls, CLinearTimeAbsolute::GetUTC(), statedata::global_regs, Good_obj, init_match(), is_rational(), Link_ok, match_everything(), mkattr(), mudstate, noisy_match_result(), NOPERM_MESSAGE, NOTHING, notify, notify_quiet, NOTYPE, attr::number, parse_to(), CLinearTimeDelta::SetSecondsString(), CLinearTimeAbsolute::SetSecondsString(), wait_que(), and WAIT_UNTIL.
00935 { 00936 CLinearTimeAbsolute ltaWhen; 00937 CLinearTimeDelta ltd; 00938 00939 // If arg1 is all numeric, do simple (non-sem) timed wait. 00940 // 00941 if (is_rational(event)) 00942 { 00943 if (key & WAIT_UNTIL) 00944 { 00945 ltaWhen.SetSecondsString(event); 00946 } 00947 else 00948 { 00949 ltaWhen.GetUTC(); 00950 ltd.SetSecondsString(event); 00951 ltaWhen += ltd; 00952 } 00953 wait_que(executor, caller, enactor, true, ltaWhen, NOTHING, 0, cmd, 00954 cargs, ncargs, mudstate.global_regs); 00955 return; 00956 } 00957 00958 // Semaphore wait with optional timeout. 00959 // 00960 char *what = parse_to(&event, '/', 0); 00961 init_match(executor, what, NOTYPE); 00962 match_everything(0); 00963 00964 dbref thing = noisy_match_result(); 00965 if (!Good_obj(thing)) 00966 { 00967 return; 00968 } 00969 else if (!Controls(executor, thing) && !Link_ok(thing)) 00970 { 00971 notify(executor, NOPERM_MESSAGE); 00972 } 00973 else 00974 { 00975 // Get timeout, default 0. 00976 // 00977 int atr = A_SEMAPHORE; 00978 bool bTimed = false; 00979 if (event && *event) 00980 { 00981 if (is_rational(event)) 00982 { 00983 if (key & WAIT_UNTIL) 00984 { 00985 ltaWhen.SetSecondsString(event); 00986 } 00987 else 00988 { 00989 ltaWhen.GetUTC(); 00990 ltd.SetSecondsString(event); 00991 ltaWhen += ltd; 00992 } 00993 bTimed = true; 00994 } 00995 else 00996 { 00997 ATTR *ap = atr_str(event); 00998 if (!ap) 00999 { 01000 atr = mkattr(executor, event); 01001 if (atr <= 0) 01002 { 01003 notify_quiet(executor, "Invalid attribute."); 01004 return; 01005 } 01006 ap = atr_num(atr); 01007 } 01008 else 01009 { 01010 atr = ap->number; 01011 } 01012 if (!bCanSetAttr(executor, thing, ap)) 01013 { 01014 notify_quiet(executor, NOPERM_MESSAGE); 01015 return; 01016 } 01017 } 01018 } 01019 01020 int num = add_to(thing, 1, atr); 01021 if (num <= 0) 01022 { 01023 // Thing over-notified, run the command immediately. 01024 // 01025 thing = NOTHING; 01026 bTimed = false; 01027 } 01028 wait_que(executor, caller, enactor, bTimed, ltaWhen, thing, atr, 01029 cmd, cargs, ncargs, mudstate.global_regs); 01030 } 01031 }
| static CLinearTimeDelta GetProcessorUsage | ( | void | ) | [static] |
Definition at line 23 of file cque.cpp.
References CLinearTimeAbsolute::GetLocal(), mudstate, CLinearTimeDelta::Set100ns(), CLinearTimeDelta::SetTimeValueStruct(), and statedata::start_time.
Referenced by Task_RunQueueEntry().
00024 { 00025 CLinearTimeDelta ltd; 00026