StephenSpeaks
asked on
I need help in creating an Operating System Benchmarking program in C/C++ (needs help bad!)
First of all, i would like to know, given the specs of the program below, how hard/feasible is the program to do in C/C++, and with what language would it be easier? (personally, i prefer C because i know more about it than C++)
I need a lot of help in making this program. Primarily because im a java programmer and i dont think i have enough knowledge in C/C++...
I would just want to know, considering the specs of our project below, what operations/commands/servic es does C offer that i can manipulate in any way in order to do an Operating Systems benchmarking program... Basically, i hope to get some sort of an outline on how to go about this program and what operations/methods/command s/services i would need to know in order to complete this. It's gonna be due in 2 weeks, and with my other subjects, im gonna be pressed for time. ANY sort of help will be apprecieted!
HERE ARE THE SPECS: (for a clearer document, the original is at http://aegis.ateneo.net/cdevera/CS161/161Pr3.doc )
When the program is run, the user will choose which feature of the operating system he wishes to benchmark. The requirements for each of the features are listed below:
File System
The following file system operations need to be measured:
Write: This test measures the performance of writing to a new file. This covers the data that needs to be written to the file as well as the overhead of information to keep track of the file (directory information, space allocation, etc)
Re-write: This test measures the performance of writing to a file that already exists.
Read: This test measures the performance of reading an existing file
Re-read: This test measures the performance of reading a file that has recently been read
Create-Delete: This test measures the performance of deleting files. A series of files is created, and then times the deletion of each of these files.
Input
When File System has been selected, the user will select the operations to be tested. The user may select one, a combination of, or all of the file system operations.
The user will also enter the range of the file sizes and the record sizes to test with. By default, the file size range to be used for the test is 64KB to 512MB, in increments by a factor of 8 (e.g., using the default, you would need data points at 64KB, 512KB, 4MB, 32MB, etc…). The default record size range is 1K to 4M, in increments by a factor of 8.
Execution
As the file size changes, the record size must be kept constant. This process is repeated for each data point for a new record size.
Output
For each of the selected operations, performance data will be displayed for each data point. This will be performance against file sizes for each given record size. Performance data will be in KB/sec. There may be multiple performance columns if you are benchmarking several operations. The output must be in the form of a table.
For example:
File Size (record size = 1 KB) Write Performance (KB/sec) Delete Performance (KB/sec)
64 KB
512 KB
…
(One table for each record size)
You have the option to graph the results in addition to the table output for bonus points.
Memory Access
Operations
Memory Access
Memory Write
Memory Copy
For memory read and write, construct multi-dimensional arrays and read/write in loop iterations in random order and measure the performance. For memory copy, create the multi-dimensional array, zero the array contents, and then time the copy from the first half of the array to the second half of the array.
Collect data points for each of the following array sizes:
[100, 100], [1000, 1000], [4000, 4000], [12000, 12000] containing
(a) integers
(b) floats
Execution:
When memory access is selected, all of the memory operations are performed. The user does not select the operation.
Output:
For each operation, the performance data will be displayed for each data point. The performance data will be in displayed in sec. The output must be in the form of a table.
For example:
Int[] of Size Write Performance Read Performance Copy Performance
100, 100
1000, 1000
(Another table for float)
Process Creation
Operations
Create child process (identical copy) and have one exit
Create child process and run new program using command interpreter
Create child process and run new program by asking system shell to find the program and run it.
Input:
Specify the name of the program(s) to be run by the child process. If more than one is specified, you will need to collect and display more data points.
Execution:
When process creation is selected, all of the listed operations are performed.
Output:
For each operation, the performance data will be displayed for each data point. The performance data will be in displayed in sec. The output must be in the form of a table.
For example:
Child Process <Program name> Performance (sec) <Program name> Performance (sec)
Identical, immediately terminated
Child using command interpreter
Child using system shell
//END OF SPECS
I need a lot of help in making this program. Primarily because im a java programmer and i dont think i have enough knowledge in C/C++...
I would just want to know, considering the specs of our project below, what operations/commands/servic
HERE ARE THE SPECS: (for a clearer document, the original is at http://aegis.ateneo.net/cdevera/CS161/161Pr3.doc )
When the program is run, the user will choose which feature of the operating system he wishes to benchmark. The requirements for each of the features are listed below:
File System
The following file system operations need to be measured:
Write: This test measures the performance of writing to a new file. This covers the data that needs to be written to the file as well as the overhead of information to keep track of the file (directory information, space allocation, etc)
Re-write: This test measures the performance of writing to a file that already exists.
Read: This test measures the performance of reading an existing file
Re-read: This test measures the performance of reading a file that has recently been read
Create-Delete: This test measures the performance of deleting files. A series of files is created, and then times the deletion of each of these files.
Input
When File System has been selected, the user will select the operations to be tested. The user may select one, a combination of, or all of the file system operations.
The user will also enter the range of the file sizes and the record sizes to test with. By default, the file size range to be used for the test is 64KB to 512MB, in increments by a factor of 8 (e.g., using the default, you would need data points at 64KB, 512KB, 4MB, 32MB, etc…). The default record size range is 1K to 4M, in increments by a factor of 8.
Execution
As the file size changes, the record size must be kept constant. This process is repeated for each data point for a new record size.
Output
For each of the selected operations, performance data will be displayed for each data point. This will be performance against file sizes for each given record size. Performance data will be in KB/sec. There may be multiple performance columns if you are benchmarking several operations. The output must be in the form of a table.
For example:
File Size (record size = 1 KB) Write Performance (KB/sec) Delete Performance (KB/sec)
64 KB
512 KB
…
(One table for each record size)
You have the option to graph the results in addition to the table output for bonus points.
Memory Access
Operations
Memory Access
Memory Write
Memory Copy
For memory read and write, construct multi-dimensional arrays and read/write in loop iterations in random order and measure the performance. For memory copy, create the multi-dimensional array, zero the array contents, and then time the copy from the first half of the array to the second half of the array.
Collect data points for each of the following array sizes:
[100, 100], [1000, 1000], [4000, 4000], [12000, 12000] containing
(a) integers
(b) floats
Execution:
When memory access is selected, all of the memory operations are performed. The user does not select the operation.
Output:
For each operation, the performance data will be displayed for each data point. The performance data will be in displayed in sec. The output must be in the form of a table.
For example:
Int[] of Size Write Performance Read Performance Copy Performance
100, 100
1000, 1000
(Another table for float)
Process Creation
Operations
Create child process (identical copy) and have one exit
Create child process and run new program using command interpreter
Create child process and run new program by asking system shell to find the program and run it.
Input:
Specify the name of the program(s) to be run by the child process. If more than one is specified, you will need to collect and display more data points.
Execution:
When process creation is selected, all of the listed operations are performed.
Output:
For each operation, the performance data will be displayed for each data point. The performance data will be in displayed in sec. The output must be in the form of a table.
For example:
Child Process <Program name> Performance (sec) <Program name> Performance (sec)
Identical, immediately terminated
Child using command interpreter
Child using system shell
//END OF SPECS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh! sorry if i came on that way! i dont really want my HW to be done. I actually asked my questions before i posted the specs. I just posted the specs so that people who would like to help would be able to take my questions into context. Here was what i asked again: :)
First of all, i would like to know, given the specs of the program below, how hard/feasible is the program to do in C/C++, and with what language would it be easier? (personally, i prefer C because i know more about it than C++)
I need a lot of help in making this program. Primarily because im a java programmer and i dont think i have enough knowledge in C/C++...
I would just want to know, considering the specs of our project below, what operations/commands/servic es does C offer that i can manipulate in any way in order to do an Operating Systems benchmarking program... Basically, i hope to get some sort of an outline on how to go about this program and what operations/methods/command s/services i would need to know in order to complete this. It's gonna be due in 2 weeks, and with my other subjects, im gonna be pressed for time. ANY sort of help will be apprecieted!
THANKS!
First of all, i would like to know, given the specs of the program below, how hard/feasible is the program to do in C/C++, and with what language would it be easier? (personally, i prefer C because i know more about it than C++)
I need a lot of help in making this program. Primarily because im a java programmer and i dont think i have enough knowledge in C/C++...
I would just want to know, considering the specs of our project below, what operations/commands/servic
THANKS!
ASKER
basically, im just looking for a guide/outline on how to try and go about my proj :)
i would just use C++ because anything thats done in C works with all C++ compilers. Thatway if you want you can switch to C++ style/functions to make some things simpler even thou you might never and just stick with C the entire time.
It is easier with C++, because you can make it modular and transparent. I mean, you can define an abstract class about benchmark, then make another specific benchmark derived from the abstract benchmark. From your main method, you can call/choose your benchmark easily.
For example:
class AbstractBenchmark {
char device_name[100];
int virtual benchmark()=0;
}
class MemoryBenchmark: AbstractBenchmark {
int size; // length of memory to be tested
int virtual benchmark();
int virtual writeBenchmark()=0;
int virtual readBenchmark()=0;
int virtual copyBenchmark()=0;
}
class IntMemoryBenchmark: MemoryBenchmark {
int test_data*;
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
}
class FloatMemoryBenchmark: MemoryBenchmark {
float test_data*;
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
}
/********* implementation *******/
int MemoryBenchmark::benchmark ()
{
return writeBenchmark() + readBenchmark() + copyBenchmark();
}
int IntMemoryBenchmark::writeB enchmark()
{
test_data = malloc(size * sizeof(int));
/* do test with integer here */
}
int FloatMemoryBenchmark::writ eBenchmark ()
{
test_data = malloc(size * sizeof(int));
/* do test with float here */
}
Another advantages is you may use template. For example, because Integer and float memory benchmark basically the same (only data type that is different), you can define
template<class T>
class MemoryBenchmark: AbstractBenchmark {
int size; // maximum size
T testdata*;
int virtual benchmark();
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
};//end class MemoryBenchmark<T>
int MemoryBenchmark<T>::writeB enchmark()
{
testdata = malloc(size * sizeof(T));
/* do test with T (may int or float) here */
}
You can create your benchmark object from main like this
main()
{
MemoryBenchmark<int> bInt;
MemoryBenchmark<float> bFloat;
....
printf("Integer Memory = %d\n", bInt.benchmark());
printf("Float Memory = %d\n", bInt.benchmark());
...
}
This is not an easy explanation,
but I hope you got the picture that C++ is powerfull.
For example:
class AbstractBenchmark {
char device_name[100];
int virtual benchmark()=0;
}
class MemoryBenchmark: AbstractBenchmark {
int size; // length of memory to be tested
int virtual benchmark();
int virtual writeBenchmark()=0;
int virtual readBenchmark()=0;
int virtual copyBenchmark()=0;
}
class IntMemoryBenchmark: MemoryBenchmark {
int test_data*;
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
}
class FloatMemoryBenchmark: MemoryBenchmark {
float test_data*;
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
}
/********* implementation *******/
int MemoryBenchmark::benchmark
{
return writeBenchmark() + readBenchmark() + copyBenchmark();
}
int IntMemoryBenchmark::writeB
{
test_data = malloc(size * sizeof(int));
/* do test with integer here */
}
int FloatMemoryBenchmark::writ
{
test_data = malloc(size * sizeof(int));
/* do test with float here */
}
Another advantages is you may use template. For example, because Integer and float memory benchmark basically the same (only data type that is different), you can define
template<class T>
class MemoryBenchmark: AbstractBenchmark {
int size; // maximum size
T testdata*;
int virtual benchmark();
int virtual writeBenchmark();
int virtual readBenchmark();
int virtual copyBenchmark();
};//end class MemoryBenchmark<T>
int MemoryBenchmark<T>::writeB
{
testdata = malloc(size * sizeof(T));
/* do test with T (may int or float) here */
}
You can create your benchmark object from main like this
main()
{
MemoryBenchmark<int> bInt;
MemoryBenchmark<float> bFloat;
....
printf("Integer Memory = %d\n", bInt.benchmark());
printf("Float Memory = %d\n", bInt.benchmark());
...
}
This is not an easy explanation,
but I hope you got the picture that C++ is powerfull.
C++ may be powerfull, but you gotta know how to use it.
you've got 2 weeks, so you might not have the time to learn everything about C++ and how to use some of its more powerfull features. and anything that is written in C will compile and run in a C++ program. C is 100% compatible with a C++ compiler. So theres no worry there. But your a java programmer so you should find C++ OO programming is somewhat the same as java, (thou there are some large diffs)
Anything you can do in C++, you can do in C. It just might take a ton more code:) but similary speaking makeing everything into classes and trying your damn hardest to make everything reuseable isn't the best idea IMHO. I've seen to many times were OO programming ideals have screw over something that could be does elagently and simpily with no OO, and turn it into a huge OO mess.
you've got 2 weeks, so you might not have the time to learn everything about C++ and how to use some of its more powerfull features. and anything that is written in C will compile and run in a C++ program. C is 100% compatible with a C++ compiler. So theres no worry there. But your a java programmer so you should find C++ OO programming is somewhat the same as java, (thou there are some large diffs)
Anything you can do in C++, you can do in C. It just might take a ton more code:) but similary speaking makeing everything into classes and trying your damn hardest to make everything reuseable isn't the best idea IMHO. I've seen to many times were OO programming ideals have screw over something that could be does elagently and simpily with no OO, and turn it into a huge OO mess.
ASKER
hey, thanks for the input guys! (btw, is there any way of giving partial points to different answers?)
but whether in C or C++, what should i use to measure the performance of the various OS? are there any methods/functions available for either programming language that would help a lot for the proj?
but whether in C or C++, what should i use to measure the performance of the various OS? are there any methods/functions available for either programming language that would help a lot for the proj?
there are no built in way to benchmark the system in C/C++ that i know of
you'll just have build them from the base up, but its not that hard to do some basic ones for the FS.
the assingment seems to give pretty detailed assesment on what to do(and someone how to) for each test.
if your useing MSVC the MSDN is a very nice tool, under linux/unix man pages are very good aswell.
the basis of benchmarking is just do something and record how long it takes and give that time a score.
reading a large file, writeing a larg file,
loading a large file into ram
how fast can the computer calculate some huge calculation (int math, FP math)
thats about it, you can get more complex but thats the basis of it,
you'll just have build them from the base up, but its not that hard to do some basic ones for the FS.
the assingment seems to give pretty detailed assesment on what to do(and someone how to) for each test.
if your useing MSVC the MSDN is a very nice tool, under linux/unix man pages are very good aswell.
the basis of benchmarking is just do something and record how long it takes and give that time a score.
reading a large file, writeing a larg file,
loading a large file into ram
how fast can the computer calculate some huge calculation (int math, FP math)
thats about it, you can get more complex but thats the basis of it,
Just one quick comment, this assignment appears to have an assumption built into it. That is that the hardware used by both OSs is the same.
The speeds you are trying to measure may vary between computers that are both running the same OS because of hardware differences. The disk IO speeds could be affected by one computer supporting 33mbs access speeds while the other could support 66mbs or even 100mbs. The memory access speeds could be affected by one computer having DDR ram with an access time of 5 nanoseconds and the other having 72 pin simms chips with an access time of 70 nanoseconds. The execution times could be affected by both of the aforementioned factors as well the the CPU clock speeds. One computer might have a 500mhz processor and the other might have a 2ghz processor. Therefore, for this test to accurate the tests for both OSs would have to be performed on computers with identical hardware. Otherwise you may end up measuring the performance of the hardware and not the OS.
Exceter
The speeds you are trying to measure may vary between computers that are both running the same OS because of hardware differences. The disk IO speeds could be affected by one computer supporting 33mbs access speeds while the other could support 66mbs or even 100mbs. The memory access speeds could be affected by one computer having DDR ram with an access time of 5 nanoseconds and the other having 72 pin simms chips with an access time of 70 nanoseconds. The execution times could be affected by both of the aforementioned factors as well the the CPU clock speeds. One computer might have a 500mhz processor and the other might have a 2ghz processor. Therefore, for this test to accurate the tests for both OSs would have to be performed on computers with identical hardware. Otherwise you may end up measuring the performance of the hardware and not the OS.
Exceter
Nothing has happened on this question in over 10 months. It's time for cleanup!
My recommendation, which I will post in the Cleanup topic area, is to
accept answer by Exceter.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jmcg
EE Cleanup Volunteer
My recommendation, which I will post in the Cleanup topic area, is to
accept answer by Exceter.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jmcg
EE Cleanup Volunteer
However, if you have a specific question about your project I'm sure that someone here will be happy to help you.
Exceter