mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Added thread counting with PsEnumThreadsByProcess and thread support in SystemProcessInformation.
svn path=/trunk/; revision=10257
This commit is contained in:
parent
651d364842
commit
b2f73e07c8
3 changed files with 50 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sysinfo.c,v 1.39 2004/07/22 17:22:36 jimtabor Exp $
|
||||
/* $Id: sysinfo.c,v 1.40 2004/07/23 07:44:25 jimtabor Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -531,12 +531,11 @@ QSI_DEF(SystemPathInformation)
|
|||
/* Class 5 - Process Information */
|
||||
QSI_DEF(SystemProcessInformation)
|
||||
{
|
||||
ULONG ovlSize=0, nThreads=1;
|
||||
ULONG ovlSize=0, nThreads;
|
||||
PEPROCESS pr, syspr;
|
||||
unsigned char *pCur;
|
||||
|
||||
/* scan the process list */
|
||||
// TODO: Add thread information
|
||||
|
||||
PSYSTEM_PROCESSES Spi
|
||||
= (PSYSTEM_PROCESSES) Buffer;
|
||||
|
@ -555,14 +554,15 @@ QSI_DEF(SystemProcessInformation)
|
|||
do
|
||||
{
|
||||
PSYSTEM_PROCESSES SpiCur;
|
||||
int curSize;
|
||||
int curSize, i = 0;
|
||||
ANSI_STRING imgName;
|
||||
int inLen=32; // image name len in bytes
|
||||
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
|
||||
SpiCur = (PSYSTEM_PROCESSES)pCur;
|
||||
|
||||
nThreads = 1; // FIXME
|
||||
nThreads = PsEnumThreadsByProcess(pr);
|
||||
|
||||
// size of the structure for every process
|
||||
curSize = sizeof(SYSTEM_PROCESSES)-sizeof(SYSTEM_THREADS)+sizeof(SYSTEM_THREADS)*nThreads;
|
||||
|
@ -613,6 +613,27 @@ QSI_DEF(SystemProcessInformation)
|
|||
// doesn't seem to contain any equivalent field
|
||||
//SpiCur->TotalPrivateBytes = pr->NumberOfPrivatePages; //FIXME: bytes != pages
|
||||
|
||||
current_entry = pr->ThreadListHead.Flink;
|
||||
while (current_entry != &pr->ThreadListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, ETHREAD,
|
||||
Tcb.ProcessThreadListEntry);
|
||||
|
||||
SpiCur->Threads[i].KernelTime.QuadPart = current->Tcb.KernelTime * 100000LL;
|
||||
SpiCur->Threads[i].UserTime.QuadPart = current->Tcb.UserTime * 100000LL;
|
||||
// SpiCur->Threads[i].CreateTime = current->CreateTime;
|
||||
SpiCur->Threads[i].WaitTime = current->Tcb.WaitTime;
|
||||
SpiCur->Threads[i].StartAddress = (PVOID) current->StartAddress;
|
||||
SpiCur->Threads[i].ClientId = current->Cid;
|
||||
SpiCur->Threads[i].Priority = current->Tcb.Priority;
|
||||
SpiCur->Threads[i].BasePriority = current->Tcb.BasePriority;
|
||||
SpiCur->Threads[i].ContextSwitchCount = 0; //FIXME!
|
||||
SpiCur->Threads[i].State = current->Tcb.State;
|
||||
SpiCur->Threads[i].WaitReason = current->Tcb.WaitReason;
|
||||
i++;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
pr = PsGetNextProcess(pr);
|
||||
|
||||
if ((pr == syspr) || (pr == NULL))
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: ps.h,v 1.61 2004/07/20 23:58:35 ion Exp $
|
||||
/* $Id: ps.h,v 1.62 2004/07/23 07:44:26 jimtabor Exp $
|
||||
*
|
||||
* FILE: ntoskrnl/ke/kthread.c
|
||||
* PURPOSE: Process manager definitions
|
||||
|
@ -529,6 +529,7 @@ VOID PsUnfreezeOtherThread(PETHREAD Thread);
|
|||
VOID PsFreezeOtherThread(PETHREAD Thread);
|
||||
VOID PsFreezeProcessThreads(PEPROCESS Process);
|
||||
VOID PsUnfreezeProcessThreads(PEPROCESS Process);
|
||||
ULONG PsEnumThreadsByProcess(PEPROCESS Process);
|
||||
PEPROCESS PsGetNextProcess(PEPROCESS OldProcess);
|
||||
VOID
|
||||
PsBlockThread(PNTSTATUS Status, UCHAR Alertable, ULONG WaitMode,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.129 2004/07/21 01:05:26 ion Exp $
|
||||
/* $Id: thread.c,v 1.130 2004/07/23 07:44:26 jimtabor Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -578,6 +578,26 @@ PsFreezeAllThreads(PEPROCESS Process)
|
|||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
}
|
||||
|
||||
ULONG
|
||||
PsEnumThreadsByProcess(PEPROCESS Process)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
ULONG Count = 0;
|
||||
|
||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||
|
||||
current_entry = Process->ThreadListHead.Flink;
|
||||
while (current_entry != &Process->ThreadListHead)
|
||||
{
|
||||
Count++;
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
return Count;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue