10 /* static struct option long_opts[] = { */
11 /* { "loglevel", 1, 0, 'l' }, */
18 /* printf("usage: cpu_spare_capacity [ options ]\n"); */
19 /* printf(" -l, --loglevel <number>|<domain>=<number>,...\n"); */
23 #define MSEC(x) { x/1000, (x%1000) * 1000000 }
24 frsh_utilization_set_t utilization_set = {
27 { .budget = MSEC(20), .period = MSEC(100), .deadline = MSEC(100) },
28 { .budget = MSEC(50), .period = MSEC(100), .deadline = MSEC(100) },
32 WVTEST_MAIN("spare capacity")
35 frsh_contract_t contract;
36 frsh_rel_time_t zero = fosa_msec_to_rel_time(0);
40 /* while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) { */
43 /* ul_log_domain_arg2levels(optarg); */
48 /* exit(opt == 'h' ? 0 : 1); */
52 setenv("WVTEST_DIE_FAST", "", 1);
55 /* Contract negotiation for CPU */
56 ret = WVFRSH(frsh_contract_init(&contract));
58 ret = WVFRSH(frsh_contract_set_basic_params(&contract,
59 &utilization_set.utilizations[0].budget,
60 &utilization_set.utilizations[0].period,
64 ret = WVFRSH(frsh_contract_set_resource_and_label(&contract ,
65 DUMMY_RESOURCE_TYPE, DUMMY_RESOURCE_ID,
68 ret = WVFRSH(frsh_contract_set_reclamation_params(&contract,
70 &utilization_set.utilizations[utilization_set.size-1].budget,
71 &utilization_set.utilizations[utilization_set.size-1].period,
77 ret = WVFRSH(frsh_contract_negotiate(&contract, &vres));
79 ret = WVFRSH(frsh_contract_cancel(vres));