summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/CORBAplus/MT_Cubit/client/client.cpp
blob: d77169446253fef1d9a711e49aff7619493ec752 (plain)
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
// $Id$

//**************************************************************************
//
// NAME :   client.C 
// DESCRIPTION:  
//
// Client for the Cubit example
//
//****************************************************************************

#include "ace/Task.h"
#include "ace/Thread_Manager.h"
#include "ace/Get_Opt.h"
#include "ace/Sched_Params.h"
#include "cubit.h"
#include "Task_Client.h"

ACE_RCSID(client, client, "$Id$")

//
// Mainline
//
int
main (int argc, char *argv[])
{
  Task_State ts (argc, argv);

  ACE::set_handle_limit ();

  Client low_client (&ts);

  // First activate the high priority client.

  Client high_client (&ts);

  ACE_Sched_Priority priority = 
    ACE_Sched_Params::priority_max (ACE_SCHED_FIFO, ACE_SCOPE_THREAD);

  ACE_DEBUG ((LM_DEBUG, "Creating client with high priority\n"));

  if (high_client.activate (THR_BOUND, 1, 0, priority) == -1)
    ACE_ERROR ((LM_ERROR, "%p\n", "activate failed"));

  priority = 
    ACE_Sched_Params::priority_min (ACE_SCHED_FIFO, ACE_SCOPE_THREAD);

  ACE_DEBUG ((LM_DEBUG, "Creating %d clients with low priority\n", ts.thread_count_ - 1));

  if (low_client.activate (THR_BOUND, ts.thread_count_ - 1, 0, priority) == -1)
    ACE_ERROR ((LM_ERROR, "%p\n", "activate failed"));


  ACE_Thread_Manager::instance ()->wait ();

  ACE_OS::printf ("Test done.\n"
                  "High priority client latency : %f msec\n"
                  "Low priority client latency : %f msec\n",
                  high_client.get_high_priority_latency (),
                  low_client.get_low_priority_latency ());

  return 0;
}