This commit adds a new attribute to the service cores attributes
API, which allows the application to retrieve the number of times
that a service-core called the service to perform its action.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
*/
#define RTE_SERVICE_ATTR_CYCLES 0
*/
#define RTE_SERVICE_ATTR_CYCLES 0
+/**
+ * Returns the count of invocations of this service function
+ */
+#define RTE_SERVICE_ATTR_CALL_COUNT 1
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice
case RTE_SERVICE_ATTR_CYCLES:
*attr_value = s->cycles_spent;
return 0;
case RTE_SERVICE_ATTR_CYCLES:
*attr_value = s->cycles_spent;
return 0;
+ case RTE_SERVICE_ATTR_CALL_COUNT:
+ *attr_value = s->calls;
+ return 0;
default:
return -EINVAL;
}
default:
return -EINVAL;
}
"Valid attr_get() call didn't return success");
TEST_ASSERT_EQUAL(0, attr_value,
"attr_get() call didn't set correct cycles (zero)");
"Valid attr_get() call didn't return success");
TEST_ASSERT_EQUAL(0, attr_value,
"attr_get() call didn't set correct cycles (zero)");
+ /* check correct call count */
+ const int attr_calls = RTE_SERVICE_ATTR_CALL_COUNT;
+ TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value),
+ "Valid attr_get() call didn't return success");
+ TEST_ASSERT_EQUAL(0, attr_value,
+ "attr_get() call didn't get call count (zero)");
/* Call service to increment cycle count */
TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
/* Call service to increment cycle count */
TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
rte_service_lcore_stop(slcore_id);
rte_service_lcore_stop(slcore_id);
+ TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value),
+ "Valid attr_get() call didn't return success");
+ TEST_ASSERT_EQUAL(1, (attr_value > 0),
+ "attr_get() call didn't get call count (zero)");
+
TEST_ASSERT_EQUAL(0, rte_service_attr_reset_all(id),
"Valid attr_reset_all() return success");
TEST_ASSERT_EQUAL(0, rte_service_attr_reset_all(id),
"Valid attr_reset_all() return success");
"Valid attr_get() call didn't return success");
TEST_ASSERT_EQUAL(0, attr_value,
"attr_get() call didn't set correct cycles (zero)");
"Valid attr_get() call didn't return success");
TEST_ASSERT_EQUAL(0, attr_value,
"attr_get() call didn't set correct cycles (zero)");
+ /* ensure call count > zero */
+ TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value),
+ "Valid attr_get() call didn't return success");
+ TEST_ASSERT_EQUAL(0, (attr_value > 0),
+ "attr_get() call didn't get call count (zero)");
return unregister_all();
}
return unregister_all();
}