1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fusiondale.h>
static char *enter_coma = "FDTestComa";
/**********************************************************************************************************************/
static void
method_func( void *ctx,
ComaMethodID method,
void *arg,
unsigned int magic )
{
IComaComponent **component = ctx;
(*component)->Return( (*component), 0, magic );
}
/**********************************************************************************************************************/
#define NUM_ITEMS 2000000
int
main( int argc, char *argv[] )
{
DirectResult ret;
IFusionDale *dale = NULL;
IComa *coma = NULL;
IComaComponent *component = NULL;
/* Initialize FusionDale including command line parsing. */
ret = FusionDaleInit( &argc, &argv );
if (ret) {
D_DERROR( ret, "FusionDale/Master: FusionDaleInit() failed!\n" );
goto out;
}
/* Create the super interface. */
ret = FusionDaleCreate( &dale );
if (ret) {
D_DERROR( ret, "FusionDale/Master: FusionDaleCreate() failed!\n" );
goto out;
}
ret = dale->EnterComa( dale, enter_coma, &coma );
if (ret) {
D_DERROR( ret, "FusionDale/Master: IFusionDale::EnterComa( '%s' ) failed!\n", enter_coma );
goto out;
}
if (argc > 1) {
coma->GetComponent( coma, "Test", 5000, &component );
void *mem;
coma->GetLocal( coma, 99, &mem );
DirectClock clock;
int counter = 0;
int retval;
direct_clock_start( &clock );
do {
component->Call( component, 1, mem, &retval );
counter++;
} while (counter < NUM_ITEMS);
direct_clock_stop( &clock );
D_INFO( "Voodoo/Test: Stopped after %lld.%03lld seconds... (%lld items/sec)\n",
DIRECT_CLOCK_DIFF_SEC_MS( &clock ), NUM_ITEMS * 1000000ULL / direct_clock_diff( &clock ) );
coma->FreeLocal( coma );
}
else {
coma->CreateComponent( coma, "Test", method_func, 0, &component, &component );
component->Activate( component );
pause();
}
out:
/* Release the component manager. */
if (coma)
coma->Release( coma );
/* Release the super interface. */
if (dale)
dale->Release( dale );
return ret;
}
|