-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmonitor.c
1944 lines (1596 loc) · 50.2 KB
/
monitor.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
*
* Copyright (c) 1997, 1998 Timpanogas Research Group, Inc. All Rights
* Reserved.
*
* AUTHOR : Jeff V. Merkey
* FILE : MONITOR.C
* DESCRIP : Console Monitor for MANOS v1.0
* DATE : January 10, 1998
*
*
***************************************************************************/
#include "stdarg.h"
#include "stdio.h"
#include "stdlib.h"
#include "ctype.h"
#include "string.h"
#include "kernel.h"
#include "keyboard.h"
#include "screen.h"
#include "types.h"
#include "emit.h"
#include "dos.h"
#include "tss.h"
#include "os.h"
#include "mps.h"
#include "hal.h"
#include "window.h"
#include "menu.h"
#include "dosfile.h"
#include "timer.h"
#include "peexe.h"
#include "line.h"
#include "loader.h"
#include "malloc.h"
#include "free.h"
#include "event.h"
extern uint32 mpt_total_pages;
extern uint32 mpt_reserved_pages;
extern uint32 mpt_physical_pages;
extern uint32 mpt_logical_pages;
extern uint32 mpt_special_pages;
extern uint32 mpt_available_pages;
extern uint32 mpt_system_page_count;
extern uint32 mpt_system_page_use_count;
extern uint32 mpt_move_counter;
extern uint32 mpt_alloc_physical_count;
extern uint32 mpt_return_physical_count;
extern LONG page_fault_success;
extern LONG page_fault_failure;
extern LONG page_fault_move_counter;
extern LONG page_fault_alloc_error;
extern LONG *mpt_physical_block_list_head;
extern LONG mpt_physical_block_activity;
extern LONG *mpt_system_list_head;
extern LONG mpt_system_page_activity;
extern LONG *mpt_list_head;
extern LONG *mpt_activity_counter;
LONG last_mpt_move_counter;
LONG last_page_fault_success;
LONG last_page_fault_failure;
LONG last_page_fault_move_counter;
LONG last_page_fault_alloc_error;
LONG last_alloc_physical_count;
LONG last_return_physical_count;
LONG last_physical_block_count;
LONG last_physical_block_activity;
LONG last_system_page_count;
LONG last_system_page_activity;
LONG last_regular_page_count;
LONG last_regular_page_activity;
LONG mpt_regular_page_count;
LONG mpt_regular_page_activity;
#define PENTIUM_EVENT 0x0011
#define PENTIUM_COUNTER_1 0x0012
#define PENTIUM_COUNTER_2 0x0013
#define PPII_COUNTER_1 0x00C1
#define PPII_COUNTER_2 0x00C2
#define PPII_EVENT_1 0x0186
#define PPII_EVENT_2 0x0187
#define PENTIUM_PPII_STDC 0x0010
#define EMON_CALL 0x01C0
#define EMON_C3 0x0180
#define EMON_C3_NON 0x0140
#define EMON_ALL 0x00C0
#define EMON_R3 0x0080
#define EMON_R3_NON 0x0040
#define EMON_NONE 0x0000
LONG PreemptiveEvents = 0;
LONG PagingCount = 0;
LONG TotalInterrupts = 0;
LONG LockAssertions = 0;
LONG PageFaults = 0;
LONG TLBShootdowns = 0;
LONG TotalXCalls;
LONG XCallFailures;
LONG XCallBusyCount;
LONG MonitorActive = 0;
LONG DaysUp = 0;
LONG HoursUp = 0;
LONG MinutesUp = 0;
LONG SecondsUp = 0;
LONG TicksUp = 0;
LONG UpdateStats = 0;
LONG EMONUpdateOK = 0;
BYTE *kernelStateArray[]={
"PS_INIT ",
"PS_ACTIVE",
"PS_SLEEP ",
"PS_SYNC ",
"PS_LWP ",
"PS_HALT ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? ",
" ????? "
};
BYTE *engineState[]={
"INACTIVE",
"ACTIVE ",
"DEBUG ",
"SIGNAL ",
"FATAL ",
"INIT ",
"SHUTDOWN",
"RESUME ",
"LOCK ",
"CURRENT ",
"SUSPEND ",
"?????? ",
"?????? ",
"?????? ",
"?????? ",
"?????? ",
"?????? ",
"?????? ",
"?????? "
};
BYTE widgets[4]={ '|', '/', '-', '\\' };
LONG EMONClocks[MAX_PROCESSORS];
LONG EMONCounter1[MAX_PROCESSORS];
LONG EMONCounter2[MAX_PROCESSORS];
LONG EMONRegisters[2] = { -1, -1 };
LWP EMONLWP[MAX_PROCESSORS];
LWP EMONLWPSet[MAX_PROCESSORS];
BYTE *PentiumEMON[]={
"Data Read ",
"Data Write ",
"Data Read or Data Write ",
"Data Read Miss ",
"Data Write Miss ",
"Data Read Miss or Data Write Miss ",
"Data TLB Miss ",
"Write (hit) to M or E state lines ",
"Data Cache Lines Written Back ",
"Data Cache Snoops ",
"Data Cache Snoop Hits ",
"Memory Accesses In Both Pipes ",
"Bank Conflicts ",
"Misaligned Data Memory References ",
"Code Read ",
"Code TLB Miss ",
"Code Cache Miss ",
"Any Segment Register Load ",
"Branches ",
"BTB Hits ",
"Taken Branch or BTB Hit ",
"Pipeline Flushes ",
"Instructions Executed ",
"Instructions Executed in the v-pipe",
"Bus Utilization (clocks) ",
"Pipeline Stalled by Write Backup ",
"Pipeline Stalled by Data Mem Read ",
"Pentium Stalled by write to E or M ",
"Locked Bus Cycle ",
"I/O Read or Write Cycle ",
"Non-cacheable memory references ",
"AGI (Address Generation Interlock) ",
"Floating Point Operations ",
"Breakpoint 0 Match ",
"Breakpoint 1 Match ",
"Breakpoint 2 Match ",
"Breakpoint 3 Match ",
"Hardware Interrupts "
};
BYTE *PentiumProEMON[]={
"Violations of Strong Ordering Detected ",
"Number of Store Buffer Forwards ",
"Number of Store Buffer Blocks ",
"Number of Store Buffer Drain Cycles ",
"Misaligned Data References ",
"Segment Register Loads ",
"Floating Point Operations (0) ",
"Floating Point Exceptions ",
"Number of Multiplies (1) ",
"Number of Divides (1) ",
"Number Busy Divider Cycles (0) ",
"Number of L2 Address Strobes ",
"L2 Cache Data Bus Busy Cycles ",
"L2 Cache Data Bus Busy During Transfer ",
"L2 Cache Allocated Lines ",
"L2 Cache Allocated M State Lines ",
"L2 Cache Evicted Lines ",
"L2 Cache M State Evicted Lines ",
"L2 Cache Instruction Fetches ",
"L2 Cache Loads (Reads) ",
"L2 Cache Stores (Writes) ",
"L2 Cache Locks ",
"L2 Cache Data Requests ",
"L2 Cache Reads ",
"L2 Cache Requests ",
"L1 Cache Data Reads ",
"L1 Cache Data Writes ",
"L1 Cache Data Locks ",
"Data Memory References ",
"L1 Cache Data Requests ",
"Lines Brought Into L1 Cache ",
"L1 Cache Allocated M State Lines ",
"L1 Cache Evicted M State Lines ",
"L1 Data Cache Misses Outstanding ",
"Data TLB Misses ",
"Breakpoint Matches ",
"External Bus Requests Outstanding ",
"Bus Clock Cycles Driving BNR Pin ",
"Bus Clock Cycles Asserting DRDY ",
"Bus Clock Cycles with LOCK# Asserted ",
"Bus Clock Cycles During PROC Data Receive ",
"Bus Burst Read Transactions ",
"Bus Read for Ownership Transactions ",
"Bus WB or M State Lines Evicted/writeback ",
"Bus Burst Instruction Fetches ",
"Bus Invalidate Transactions ",
"Bus Partial Write Transactions ",
"Bus Partial Mem Transactions/MemMappedIO ",
"Bus IO Transactions (IN/OUT) ",
"Bus Deferred Reply Transactions ",
"Bus Burst Transactions ",
"Bus Memory Transactions ",
"Bus Transactions ",
"Burst Reads Snooped By L1 ",
"Invalidate Transactions Snooped by L1 ",
"Bus Requests Snooped by L1 ",
"Burst Reads Snooped by L1 and L2 ",
"Invalidates Snooped by L1 and L2 ",
"Bus Requests Snooped by L1 and L2 ",
"Snoop Responses to Transactions (ext bus) ",
"Number of Data Bus Stalls ",
"CPU Not Halted Cycles ",
"Number HIT pin Assertions ",
"Number HITM pin Assertions ",
"Number AERR pin Assertions ",
"Number BERR pin Assertions ",
"BINIT pin Assertions/Bus Snoop Stalls ",
"Instruction Fetches ",
"Instruction Fetch Misses ",
"Uncacheable Instruction Fetches ",
"Prefetch Hits ",
"Breakpoint Matches ",
"Instruction TLB Misses ",
"Cycles Instruction Fetch is Stalled ",
"Cycles Instruction Fetch is Stalled (pipe)",
"UOPs Dispatched from Resv. Stn ",
"Cycles during UOP Dispatch ",
"Resource Related Stalls ",
"Instructions Retired ",
"Floating Point Operations Retired (0) ",
"UOPs Retired ",
"Self Modifying Code Detected ",
"Branch Instructions Retired ",
"Branch Miss-Predictions Retired ",
"Clocks While Interrupts are Masked ",
"Clocks While Interrupts are Masked/Pending",
"Hardware Interrupts ",
"Taken Branches Retired ",
"Taken Mispredictions Retired ",
"Instructions Decoded ",
"OUPs Decoded ",
"Register Renaming (Partial) Stalls ",
"Cycles that Register Renaming Stalls Occur",
"Branch Instructions Decoded ",
"BTB Hits ",
"BTB Misses ",
"Return Stack Buffer Hits ",
"Bogus Branches Detected ",
"Mispredicted Returns Retired ",
"Number of BACLEARS# Asserted "
};
LONG PentiumEMONCodes[] = {
0x00, 0x01, 0x28, 0x03, 0x04, 0x29, 0x02, 0x05, 0x06, 0x07, 0x08, 0x09,
0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x22, 0x23, 0x24, 0x25,
0x26, 0x27
};
LONG PentiumProEMONCodes[] =
{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x10, 0x11, 0x12, 0x13, 0x14, 0x21,
0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D,
0x2E, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x80, 0x81, 0x82, 0x83, 0x84,
0x85, 0x86, 0x87, 0xA0, 0xA1, 0xA2, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5,
0xC6, 0xC7, 0xC8, 0xC9, 0xCa, 0xD0, 0xD1, 0xD2, 0xD3, 0xE0, 0xE1, 0xE2,
0xE3, 0xE4, 0xE5, 0xE6
};
extern LONG NumberOfOpenHandles;
extern LONG TotalSystemMemory;
extern LONG HighMemoryLength;
extern LONG LowMemoryLength;
extern BYTE kernelState[];
extern LONG ConnectionsAllowed;
extern LONG ConnectionsOpen;
extern LONG systemThreadCount;
extern BYTE ServerName[];
extern void ReadMSR(LONG msr, LONG *val1, LONG *val2);
extern void WriteMSR(LONG msr, LONG *val1, LONG *val2);
LONG gwNum;
LONG resizeEvent = 0;
SCREEN *monitorScreen = 0;
void VMUpdate(LONG wNum)
{
BYTE displayBuffer[100] = { "" };
register LONG i;
while (1)
{
sprintf(displayBuffer,
" Total Pages: %8u", mpt_total_pages);
write_portal(wNum, displayBuffer, 1, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Reserved Pages: %8u", mpt_reserved_pages);
write_portal(wNum, displayBuffer, 2, 1, BRITEWHITE | BGBLUE);
if (mpt_system_list_head[1] < last_system_page_count)
{
sprintf(displayBuffer,
" System Pages: %8u -%8u [%8u]",
mpt_system_list_head[1],
last_system_page_count - mpt_system_list_head[1],
mpt_system_page_activity - last_system_page_activity);
}
else
{
sprintf(displayBuffer,
" System Pages: %8u +%8u [%8u]",
mpt_system_list_head[1],
mpt_system_list_head[1] - last_system_page_count,
mpt_system_page_activity - last_system_page_activity);
}
last_system_page_activity = mpt_system_page_activity;
last_system_page_count = mpt_system_list_head[1];
write_portal(wNum, displayBuffer, 3, 1, BRITEWHITE | BGBLUE);
mpt_regular_page_count = mpt_list_head[(0 * 1024) + 1] +
mpt_list_head[(1 * 1024) + 1] +
mpt_list_head[(2 * 1024) + 1] +
mpt_list_head[(3 * 1024) + 1];
mpt_regular_page_activity = mpt_activity_counter[(0 * 1024) + 1] +
mpt_activity_counter[(1 * 1024) + 1] +
mpt_activity_counter[(2 * 1024) + 1] +
mpt_activity_counter[(3 * 1024) + 1];
if (mpt_regular_page_count < last_regular_page_count)
{
sprintf(displayBuffer,
" Available Pages: %8u -%8u [%8u]",
mpt_regular_page_count,
last_regular_page_count - mpt_regular_page_count,
mpt_regular_page_activity - last_regular_page_activity);
}
else
{
sprintf(displayBuffer,
" Available Pages: %8u +%8u [%8u]",
mpt_regular_page_count,
mpt_regular_page_count - last_regular_page_count,
mpt_regular_page_activity - last_regular_page_activity);
}
last_regular_page_activity = mpt_regular_page_activity;
last_regular_page_count = mpt_regular_page_count;
write_portal(wNum, displayBuffer, 4, 1, BRITEWHITE | BGBLUE);
if (mpt_physical_block_list_head[1] < last_physical_block_count)
{
sprintf(displayBuffer,
" Physical Blocks: %8u -%8u [%8u]",
mpt_physical_block_list_head[1],
last_physical_block_count - mpt_physical_block_list_head[1],
mpt_physical_block_activity - last_physical_block_activity);
}
else
{
sprintf(displayBuffer,
" Physical Blocks: %8u +%8u [%8u]",
mpt_physical_block_list_head[1],
mpt_physical_block_list_head[1] - last_physical_block_count,
mpt_physical_block_activity - last_physical_block_activity);
}
last_physical_block_activity = mpt_physical_block_activity;
last_physical_block_count = mpt_physical_block_list_head[1];
write_portal(wNum, displayBuffer, 5, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Moved Pages: %8u %8u", mpt_move_counter - last_mpt_move_counter, mpt_move_counter);
write_portal(wNum, displayBuffer, 8, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Page Faults: %8u %8u", page_fault_success - last_page_fault_success, page_fault_success);
write_portal(wNum, displayBuffer, 9, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Page Faults Failures: %8u %8u", page_fault_failure - last_page_fault_failure, page_fault_failure);
write_portal(wNum, displayBuffer, 10, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Page Faults Moves: %8u %8u", page_fault_move_counter - last_page_fault_move_counter, page_fault_move_counter);
write_portal(wNum, displayBuffer, 11, 1, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Page Fault Postpones: %8u %8u", page_fault_alloc_error - last_page_fault_alloc_error, page_fault_alloc_error);
write_portal(wNum, displayBuffer, 12, 1, BRITEWHITE | BGBLUE);
last_mpt_move_counter = mpt_move_counter;
last_page_fault_success = page_fault_success;
last_page_fault_failure = page_fault_failure;
last_page_fault_move_counter = page_fault_move_counter;
last_page_fault_alloc_error = page_fault_alloc_error;
update_portal(wNum);
delayThread(18);
}
}
void VMPortalProcess(SCREEN *screen)
{
register LONG i, key;
register LONG wNum;
register PROCESS *child;
UpdateStats = 0;
wNum = make_portal(screen,
" Virtual Memory Information ",
3, // window start
0,
screen->nLines - 1,
screen->nCols - 1, // window end
100, // number of lines
1,
YELLOW | BGBLUE,
YELLOW | BGBLUE,
BRITEWHITE | BGBLUE,
BRITEWHITE | BGBLUE,
0);
if (wNum)
{
child = createThread("Virtual Memory Update", (LONG (*)()) VMUpdate,
8192 * 2, (void *) wNum, 0);
if (child)
{
activate_portal(wNum);
killThread(child);
free_portal(wNum);
}
}
UpdateStats = TRUE;
return;
}
void UpdateTime(SCREEN *screen)
{
BYTE displayBuffer[100] = { "" };
LONG date, time;
while (1)
{
GetCMOSDate(&date);
GetCMOSTime(&time);
sprintf(displayBuffer,
"%02X-%02X-%02X %2X:%02X:%02X%c",
(date >> 16) & 0xFF,
(date >> 8) & 0xFF,
(date >> 24) & 0xFF,
(time >> 16) & 0xFF,
(time >> 8) & 0xFF,
time & 0xFF);
PutVidString(screen, displayBuffer, 60, 0, BLUE | BGCYAN);
delayThread(18);
}
}
void ConsoleUpdate(LONG wNum)
{
register LONG i;
register LONG cW = 0;
BYTE displayBuffer[100] = { "" };
TotalInterrupts = 0;
LockAssertions = 0;
TLBShootdowns = 0;
PageFaults = 0;
TotalXCalls = 0;
XCallFailures = 0;
XCallBusyCount = 0;
for (i=0; i < active_processors; i++)
{
processor_table[i].totalInterrupts = 0;
processor_table[i].lockAssertions = 0;
processor_table[i].TLBShootdowns = 0;
processor_table[i].pageFaults = 0;
processor_table[i].xcall_total = 0;
processor_table[i].xcall_fail = 0;
processor_table[i].xcall_busy = 0;
}
while (1)
{
if (UpdateStats)
{
TotalInterrupts = 0;
LockAssertions = 0;
TLBShootdowns = 0;
PageFaults = 0;
TotalXCalls = 0;
XCallFailures = 0;
XCallBusyCount = 0;
for (i=0; i < active_processors; i++)
{
TotalInterrupts += processor_table[i].totalInterrupts;
processor_table[i].totalInterrupts = 0;
LockAssertions += processor_table[i].lockAssertions;
processor_table[i].lockAssertions = 0;
TLBShootdowns += processor_table[i].TLBShootdowns;
processor_table[i].TLBShootdowns = 0;
PageFaults += processor_table[i].pageFaults;
processor_table[i].pageFaults = 0;
TotalXCalls += processor_table[i].xcall_total;
processor_table[i].xcall_total = 0;
XCallFailures += processor_table[i].xcall_fail;
XCallBusyCount += processor_table[i].xcall_busy;
}
sprintf(displayBuffer,
" Number Of Processors : %6u Server Up Time : %4d:%02d:%02d:%02d [%c]",
num_procs,
DaysUp,
HoursUp,
MinutesUp,
SecondsUp,
widgets[cW++ & 3]);
write_portal(wNum, displayBuffer, 0, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Active Processors : %6u Total System Memory : %12u bytes",
active_processors,
TotalSystemMemory);
write_portal(wNum, displayBuffer, 1, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Utilization : %6u%% Memory Above 1MB : %12u bytes",
systemUtilization,
HighMemoryLength);
write_portal(wNum, displayBuffer, 2, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Total XCalls : %6u Memory Below 1MB : %12u bytes",
TotalXCalls,
LowMemoryLength);
write_portal(wNum, displayBuffer, 3, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" XCall Failures : %6u TLB Shootdowns : %12u",
XCallFailures,
TLBShootdowns);
write_portal(wNum, displayBuffer, 4, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Preemptive Events : %6u Page Faults : %12u",
PreemptiveEvents,
PageFaults);
write_portal(wNum, displayBuffer, 5, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Interrupts/second : %6u Locks/second : %12u",
TotalInterrupts,
LockAssertions);
write_portal(wNum, displayBuffer, 6, 0, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Paging Count : %6u XCall Busy Count : %12u",
PagingCount,
XCallBusyCount);
write_portal(wNum, displayBuffer, 7, 0, BRITEWHITE | BGBLUE);
PreemptiveEvents = 0;
PagingCount = 0;
update_static_portal(wNum);
}
delayThread(18);
}
}
void ProcessorUpdate(LONG wNum)
{
BYTE displayBuffer[100] = { "" };
register LONG i;
register LONG x, y;
while (1)
{
for (i=0; i < MAX_PROCESSORS; i++)
{
if (i & 1)
y = 40;
else
y = 2;
switch (i)
{
case 0:
case 1:
x = 0;
break;
case 2:
case 3:
x = 9;
break;
case 4:
case 5:
x = 18;
break;
case 6:
case 7:
x = 27;
break;
}
sprintf(displayBuffer,
" Processor : %6u", processor_table[i].ProcessorNumber);
write_portal(wNum, displayBuffer, x + 1, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Processor State : %s", engineState[processor_table[i].ProcessorState & 0xF]);
write_portal(wNum, displayBuffer, x + 2, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Utilization : %6u%%", processorUtilization[i]);
write_portal(wNum, displayBuffer, x + 3, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Interrupts : %6u", processor_table[i].totalInterrupts);
write_portal(wNum, displayBuffer, x + 4, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Locks : %6u", processor_table[i].lockAssertions);
write_portal(wNum, displayBuffer, x + 5, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" TLB Shootdowns : %6u", processor_table[i].TLBShootdowns);
write_portal(wNum, displayBuffer, x + 6, y, BRITEWHITE | BGBLUE);
sprintf(displayBuffer,
" Page Faults : %6u", processor_table[i].pageFaults);
write_portal(wNum, displayBuffer, x + 7, y, BRITEWHITE | BGBLUE);
processor_table[i].totalInterrupts = 0;
processor_table[i].lockAssertions = 0;
processor_table[i].TLBShootdowns = 0;
processor_table[i].pageFaults = 0;
}
update_portal(wNum);
delayThread(18);
}
}
void ProcessorPortalProcess(SCREEN *screen)
{
register LONG i, key;
register LONG wNum;
register PROCESS *child;
UpdateStats = 0;
wNum = make_portal(screen,
" Processor Information ",
3,
0,
screen->nLines - 1,
screen->nCols - 1,
36,
1,
YELLOW | BGBLUE,
YELLOW | BGBLUE,
BRITEWHITE | BGBLUE,
BRITEWHITE | BGBLUE,
0);
if (wNum)
{
child = createThread("Processor Update", (LONG (*)()) ProcessorUpdate,
8192 * 2, (void *) wNum, 0);
if (child)
{
activate_portal(wNum);
killThread(child);
free_portal(wNum);
}
}
UpdateStats = TRUE;
return;
}
BYTE lDelim[] = {
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4
};
LONG moduleAction(SCREEN *screen, LONG value, BYTE *option)
{
BYTE buf[255];
register LONG wNum;
MODULE_HANDLE *module;
if (screen) {};
if (option) {};
sprintf(buf, " %s Module Information ", option);
wNum = create_window(screen,
buf,
5,
4,
22,
75,
1,
YELLOW | BGBLUE,
YELLOW | BGBLUE,
BRITEWHITE | BGBLUE,
BRITEWHITE | BGBLUE,
1);
if (!wNum)
return -1;
activate_window(wNum);
module = (MODULE_HANDLE *) value;
sprintf(buf, "%s", module->ModuleName);
window_write_string(wNum, buf, 1, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Short Name : %s Entry : %08X Size : %08X",
module->ModuleShortName,
module->entryPoint,
module->BaseSize);
window_write_string(wNum, buf, 2, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Range : %08X-%08X BaseRVA : %08X",
module->ModuleStart,
module->ModuleEnd,
module->PEBase);
window_write_string(wNum, buf, 3, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Import Directory : %08X Export Directory : %08X",
module->ImportDirectory,
module->ExportDirectory);
window_write_string(wNum, buf, 4, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Code Segment : %08X Code Size : (%08X) %u bytes",
module->CodeSegmentPtr,
module->CodeSegmentSize,
module->CodeSegmentSize);
window_write_string(wNum, buf, 5, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Data Segment : %08X Data Size : (%08X) %u bytes",
module->DataSegmentPtr,
module->DataSegmentSize,
module->DataSegmentSize);
window_write_string(wNum, buf, 6, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Reloc Segment : %08X Reloc Size : (%08X) %u bytes",
module->RelocSegmentPtr,
module->RelocSegmentSize,
module->RelocSegmentSize);
window_write_string(wNum, buf, 7, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Init Segment : %08X Init Size : (%08X) %u bytes",
module->InitSegmentPtr,
module->InitSegmentSize,
module->InitSegmentSize);
window_write_string(wNum, buf, 8, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Import Segment : %08X Import Size : (%08X) %u bytes",
module->ImportSegmentPtr,
module->ImportSegmentSize,
module->ImportSegmentSize);
window_write_string(wNum, buf, 9, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Export Segment : %08X Export Size : (%08X) %u bytes",
module->ExportSegmentPtr,
module->ExportSegmentSize,
module->ExportSegmentSize);
window_write_string(wNum, buf, 10, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Shared Segment : %08X Shared Size : (%08X) %u bytes",
module->SharedSegmentPtr,
module->SharedSegmentSize,
module->SharedSegmentSize);
window_write_string(wNum, buf, 11, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"RPC Segment : %08X RPC Size : (%08X) %u bytes",
module->RPCSegmentPtr,
module->RPCSegmentSize,
module->RPCSegmentSize);
window_write_string(wNum, buf, 12, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Resource Seg : %08X Resource Sz : (%08X) %u bytes",
module->ResourceSegmentPtr,
module->ResourceSegmentSize,
module->ResourceSegmentSize);
window_write_string(wNum, buf, 13, 1, BRITEWHITE | BGBLUE);
sprintf(buf,
"Debug Segment : %08X Debug Size : (%08X) %u bytes",
module->DebugSegmentPtr,
module->DebugSegmentSize,
module->DebugSegmentSize);
window_write_string(wNum, buf, 14, 1, BRITEWHITE | BGBLUE);
ReadKeyboard(screen);
free_window(wNum);
return 0;
}
void ModuleInfo(SCREEN *screen)
{
register LONG mNum;
register LONG i;
register MODULE_HANDLE *module;
UpdateStats = 0;
mNum = make_menu(screen,
" Loaded Modules ",
2,
30,
18,
1,
YELLOW | BGBLUE,
YELLOW | BGBLUE,
BRITEWHITE | BGBLUE,
BRITEWHITE | BGBLUE,
moduleAction,
0);
if (mNum)
{
module = moduleListHead;
for (i=0; i < NumberOfModules && module; i++)
{
add_item_to_menu(mNum, module->ModuleShortName, (LONG) module);
module = module->next;
}
activate_menu(mNum);
free_menu(mNum);
}
UpdateStats = TRUE;
return;
}
void LANWANInfo(SCREEN *screen)
{
register LONG mNum;
register LONG i;
register MODULE_HANDLE *module;
UpdateStats = 0;
mNum = make_portal(screen,
" LAN/WAN Driver Information ",
3,
1,
screen->nLines - 2,
screen->nCols - 2,
40,
1,
YELLOW | BGBLUE,
YELLOW | BGBLUE,
BRITEWHITE | BGBLUE,
BRITEWHITE | BGBLUE,
0);