summaryrefslogtreecommitdiff
path: root/orc-test
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2010-08-01 18:33:27 -0700
committerDavid Schleef <ds@schleef.org>2010-08-01 18:33:27 -0700
commit86e0d577b27624ded3dabdb3144f486ad76d1d14 (patch)
tree0c335420f74456290a44311aedc27d18601a25e0 /orc-test
parent36a2d14b39e18f3f2f50e37e80f50ea6f12c7d14 (diff)
Add performance comparison tests
Diffstat (limited to 'orc-test')
-rw-r--r--orc-test/orctest.c21
-rw-r--r--orc-test/orctest.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/orc-test/orctest.c b/orc-test/orctest.c
index 8ce24c9..07bb334 100644
--- a/orc-test/orctest.c
+++ b/orc-test/orctest.c
@@ -801,10 +801,16 @@ orc_test_get_program_for_opcode_param (OrcStaticOpcode *opcode)
return p;
}
-
void
orc_test_performance (OrcProgram *program, int flags)
{
+ orc_test_performance_full (program, flags, NULL);
+}
+
+double
+orc_test_performance_full (OrcProgram *program, int flags,
+ const char *target_name)
+{
OrcExecutor *ex;
int n;
int m;
@@ -815,20 +821,21 @@ orc_test_performance (OrcProgram *program, int flags)
OrcCompileResult result;
OrcProfile prof;
double ave, std;
+ OrcTarget *target;
ORC_DEBUG ("got here");
+ target = orc_target_get_by_name (target_name);
+
if (!(flags & ORC_TEST_FLAGS_BACKUP)) {
- OrcTarget *target;
unsigned int flags;
- target = orc_target_get_default ();
flags = orc_target_get_default_flags (target);
result = orc_program_compile_full (program, target, flags);
if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) {
- printf("compile failed\n");
- return;
+ //printf("compile failed\n");
+ return 0;
}
}
@@ -891,7 +898,7 @@ orc_test_performance (OrcProgram *program, int flags)
ORC_DEBUG ("done running");
orc_profile_get_ave_std (&prof, &ave, &std);
- printf("%g %g\n", ave/(n*m), std/(n*m));
+ //printf("%g %g\n", ave/(n*m), std/(n*m));
for(i=0;i<4;i++){
if (dest_exec[i]) orc_array_free (dest_exec[i]);
@@ -903,6 +910,6 @@ orc_test_performance (OrcProgram *program, int flags)
orc_executor_free (ex);
- return;
+ return ave/(n*m);
}
diff --git a/orc-test/orctest.h b/orc-test/orctest.h
index 325d573..55188de 100644
--- a/orc-test/orctest.h
+++ b/orc-test/orctest.h
@@ -30,6 +30,8 @@ OrcProgram *orc_test_get_program_for_opcode_const (OrcStaticOpcode *opcode);
OrcProgram *orc_test_get_program_for_opcode_param (OrcStaticOpcode *opcode);
void orc_test_performance (OrcProgram *program, int flags);
+double orc_test_performance_full (OrcProgram *program, int flags,
+ const char *target);
ORC_END_DECLS