aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/test/PerformanceTest.pl
diff options
context:
space:
mode:
Diffstat (limited to 'share/perl/test/PerformanceTest.pl')
-rw-r--r--share/perl/test/PerformanceTest.pl78
1 files changed, 78 insertions, 0 deletions
diff --git a/share/perl/test/PerformanceTest.pl b/share/perl/test/PerformanceTest.pl
new file mode 100644
index 0000000..5f570e8
--- /dev/null
+++ b/share/perl/test/PerformanceTest.pl
@@ -0,0 +1,78 @@
1#!/usr/bin/perl
2
3# Usage:
4# ./PerformanceTest.pl
5# 2 variables should be changed:
6# Line 14: $fork_limit
7# Line 13: $benchmark_loop_count
8#
9
10use strict;
11use OpenSimTest;
12
13my $script = "./PerformanceTest.pl";
14my $fork_limit = 50; # the number of process
15my $benchmark_loop_count = 10000; # the number of requests sent by each process
16
17my @child_pid = ();
18
19for(1..$fork_limit) {
20 my $pid = fork;
21 if ($pid) {
22 &parent_do($pid);
23 } elsif ($pid == 0) {
24 &child_do;
25 exit(0);
26 } else {
27 die "could not fork";
28 }
29}
30
31foreach (@child_pid) {
32 waitpid($_, 0);
33}
34
35
36sub parent_do {
37 my $pid = shift;
38 push(@child_pid, $pid);
39}
40
41sub child_do {
42 #for(1..10000) {
43 # print "$_ ";
44 #}
45 &OpenSimTest::init();
46 # user
47 &OpenSimTest::PerformanceCompare("user", $benchmark_loop_count, "get_user_by_name", "Test User");
48 &OpenSimTest::PerformanceCompare("user", $benchmark_loop_count, "get_user_by_uuid", "db836502-de98-49c9-9edc-b90a67beb0a8");
49 # grid
50 &OpenSimTest::PerformanceCompare("grid", $benchmark_loop_count, "simulator_login", "3507f395-88e5-468c-a45f-d4fd96a1c668", "10.8.1.148", 9000);
51 &OpenSimTest::PerformanceCompare("grid", $benchmark_loop_count, "simulator_data_request", "1099511628032000");
52 &OpenSimTest::PerformanceCompare("grid", $benchmark_loop_count, "map_block", 999, 999, 1001, 1001);
53 # asset
54 &OpenSimTest::PerformanceCompare("asset", $benchmark_loop_count, "get_asset", "00000000000022223333000000000001");
55 # inventory
56 &OpenSimTest::PerformanceCompare("inventory", $benchmark_loop_count, "root_folders", "b9cb58e8-f3c9-4af5-be47-029762baa68f");
57 &OpenSimTest::PerformanceCompare("inventory", $benchmark_loop_count, "get_inventory", "b9cb58e8-f3c9-4af5-be47-029762baa68f");
58}
59
60__END__
61my $count = 10000;
62
63&OpenSimTest::init();
64# user
65#&OpenSimTest::PerformanceCompare("user", $count, "get_user_by_name", "Test User");
66#&OpenSimTest::PerformanceCompare("user", $count, "get_user_by_uuid", "db836502-de98-49c9-9edc-b90a67beb0a8");
67# grid
68#&OpenSimTest::PerformanceCompare("grid", $count, "simulator_login", "3507f395-88e5-468c-a45f-d4fd96a1c668", "10.8.1.148", 9000);
69#&OpenSimTest::PerformanceCompare("grid", $count, "simulator_data_request", "1099511628032000");
70#&OpenSimTest::PerformanceCompare("grid", $count, "map_block", 999, 999, 1001, 1001);
71# asset
72&OpenSimTest::PerformanceCompare("asset", $count, "get_asset", "00000000000022223333000000000001");
73# inventory
74#&OpenSimTest::PerformanceCompare("inventory", $count, "create_inventory", "b9cb58e8-f3c9-4af5-be47-029762baa68f");
75#&OpenSimTest::PerformanceCompare("inventory", $count, "root_folders", "b9cb58e8-f3c9-4af5-be47-029762baa68f");
76#&OpenSimTest::PerformanceCompare("inventory", $count, "get_inventory", "b9cb58e8-f3c9-4af5-be47-029762baa68f");
77#&OpenSimTest::PerformanceCompare("inventory", $count, "new_item");
78#&OpenSimTest::PerformanceCompare("inventory", $count, "new_folder");