forked from mit-pdos/xv6-public
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Make-IT-Wright/implement_ps
Implement ps
- Loading branch information
Showing
10 changed files
with
132 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "types.h" | ||
#include "stat.h" | ||
#include "user.h" | ||
|
||
static volatile int counter = 0; | ||
|
||
int loop(int n) | ||
{ | ||
for(int i = n * 4096; i > 0; --i) { | ||
for(int j = n * 4096; j > 0; --j) { | ||
counter += 1; | ||
} | ||
} | ||
return counter; | ||
} | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
for(int j = 3; j > 0; --j) { | ||
loop(j); | ||
} | ||
exit(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
#ifndef TYPES_H | ||
#define TYPES_H | ||
|
||
typedef unsigned int uint; | ||
typedef unsigned short ushort; | ||
typedef unsigned char uchar; | ||
typedef uint pde_t; | ||
|
||
enum procstate { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; | ||
|
||
#define MAX_PROC_NAME_LENGTH (16) | ||
struct procInfo { | ||
int state; | ||
int pid; | ||
int cpuPercent; | ||
char name[MAX_PROC_NAME_LENGTH]; | ||
}; | ||
|
||
#endif // TYPES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters