📄 sched_conf_anomalies.cpp
字号:
// Sched_Conf_Anomalies.cpp,v 1.14 2003/08/24 18:21:41 venkita Exp
// This program performa a simple scheduler configuration run,
// and dumps the results of one scheduling into a C++ header file.
#include "ace/Sched_Params.h"
#include "ace/Get_Opt.h"
#include "tao/corba.h"
#include "orbsvcs/CosNamingC.h"
#include "orbsvcs/Scheduler_Factory.h"
#include "orbsvcs/Naming/Naming_Utils.h"
ACE_RCSID(Sched_Conf, Sched_Conf_Anomalies, "Sched_Conf_Anomalies.cpp,v 1.14 2003/08/24 18:21:41 venkita Exp")
const char* service_name = "ScheduleService";
const char* format_string = "{%-12s, %d, %d, %d, %d, %8d, "
"ACE_static_cast (RtecScheduler::Criticality_t, %d), "
"ACE_static_cast (RtecScheduler::Importance_t, %d), "
"%d, %d, %3d, %d, %d, "
"ACE_static_cast (RtecScheduler::Info_Type_t, %d)}\n";
int
parse_args (int argc, char *argv [])
{
ACE_Get_Opt get_opt (argc, argv, "n:");
int opt;
while ((opt = get_opt ()) != EOF)
{
switch (opt)
{
case 'n':
service_name = get_opt.opt_arg ();
break;
case '?':
default:
ACE_DEBUG ((LM_DEBUG,
"Usage: %s "
"-n service_name "
"\n",
argv[0]));
return -1;
}
}
return 0;
}
int
main (int argc, char *argv[])
{
if (parse_args (argc, argv) != 0)
{
return 1;
}
// create initial data for supplier and consumer operations
const int operation_count = 8;
ACE_Scheduler_Factory::POD_RT_Info config_infos[operation_count] = {
// good supplier (no unresolved dependencies)
{ "good_supplier", // entry point
0, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
500000, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
1, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// good consumer (no unresolved dependencies)
{ "good_consumer", // entry point
1, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// supplier with unresolved remote dependencies
{ "unresolved_remote_supplier", // entry point
2, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::REMOTE_DEPENDANT // info type
},
// consumer with unresolved remote dependencies
{ "unresolved_remote_consumer", // entry point
3, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// supplier with unresolved local dependencies
{ "unresolved_local_supplier", // entry point
4, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// consumer with unresolved local dependencies
{ "unresolved_local_consumer", // entry point
5, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// consumer with unresolved local and remote dependencies
{ "both_unresolved_consumer_1", // entry point
6, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
},
// another consumer with unresolved
// local and remote dependencies
{ "both_unresolved_consumer_2", // entry point
7, // handle
5000, // worst case execution time
5000, // typical execution time (unused)
5000, // cached execution time
0, // period (100 ns)
RtecScheduler::HIGH_CRITICALITY, // criticality
RtecScheduler::LOW_IMPORTANCE, // importance
0, // quantum (unused)
0, // threads
0, // OS priority
0, // Preemption subpriority
0, // Preemption priority
RtecScheduler::OPERATION // info type
}
};
ACE_TRY_NEW_ENV
{
// Initialize ORB.
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, "internet" ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
if (CORBA::is_nil(poa_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -