summaryrefslogtreecommitdiffstats
path: root/src/include/usr
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2013-10-30 16:41:53 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-11-07 13:23:00 -0600
commit4de836b2c0ce05bdd51768daa2de666189df1453 (patch)
tree787197ae7ac55f34994820d27429287b40cffb63 /src/include/usr
parent08afd2ffe6aa01c14c0942b25da3bb175cd02d94 (diff)
downloadtalos-hostboot-4de836b2c0ce05bdd51768daa2de666189df1453.tar.gz
talos-hostboot-4de836b2c0ce05bdd51768daa2de666189df1453.zip
Optimized association lookup performance
- Updated attribute compiler to serialize association lists into binary - Updated getAssociated call to optimally search associations - Fixed IBSCOM unit test to look at present/functional targets - Added association list pointers to target object - Removed unused association types, added max association type - Removed association direction enum - Removed association type to attribute type mapping and container - Removed association type to attribute type container initialization - Removed getAssocaited helper functions (get inwards / get outwards) Change-Id: I3b595781d881911b3808f4f91833437a5cac6eb3 RTC: 88619 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7003 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr')
-rw-r--r--src/include/usr/targeting/common/target.H13
-rw-r--r--src/include/usr/targeting/common/targetservice.H166
2 files changed, 62 insertions, 117 deletions
diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H
index ffeecd340..b85e80667 100644
--- a/src/include/usr/targeting/common/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -533,6 +533,17 @@ class Target
// Pointer to array of void* (which point to attributes)
TARGETING::AbstractPointer< AbstractPointer<void> > iv_pAttrValues;
+ // Array of pointers to target handles. Currently there is one pointer
+ // for each supported association type. The currently supported
+ // association types are PARENT, CHILD, PARENT_BY_AFFINITY, and
+ // CHILD_BY_AFFINTY. The number of pointers should exactly equal value
+ // of TargetService::MAX_ASSOCIATION_TYPES defined in
+ // targeting/common/targetservice.H. Due to the huge code changes
+ // necessary to directly use that enum value, a compile time assert in
+ // targeting/common/targetservice.C enforces that restriction.
+ TARGETING::AbstractPointer< AbstractPointer<Target> >
+ iv_ppAssociations[4];
+
private: // Private CTORs/DTORs/Operators
/**
@@ -559,6 +570,8 @@ class Target
friend class PnorBuilderService;
friend class TargetCloner;
+ friend class TargetService;
+ friend class AssociationManager;
// Friend functions to allow FAPI Attribute code to directly call
// _tryGetAttr and _trySetAttr for code size optimization
diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H
index 6dd2cd2f0..a24b6eac8 100644
--- a/src/include/usr/targeting/common/targetservice.H
+++ b/src/include/usr/targeting/common/targetservice.H
@@ -177,10 +177,7 @@ class TargetService
///< Hardware affinity. For example the child
///< of a memory controller channel target might
///< be a DIMM target
- VOLTAGE_SUPPLIER, ///< The result target(s) should be the voltage
- ///< supplier
- VOLTAGE_CONSUMER, ///< The result target(s) should be the voltage
- ///< consumer
+ MAX_ASSOCIATION_TYPES, ///< Number of types, must always be last
};
public:
@@ -488,10 +485,10 @@ class TargetService
EntityPath& o_entityPath) const;
/**
- * @brief Returns entity paths of targets associated to the specified
- * target in a specific way
+ * @brief Returns handles to targets associated to the specified
+ * target in a specific way, in depth first order
*
- * Returns entity paths of targets associated to the specified target,
+ * Returns handles to targets associated to the specified target,
* as indicated by an association type. Based on the specified
* recursion level, the routine will determine the immediate
* associations, or all possible associations. For example, if caller
@@ -499,11 +496,13 @@ class TargetService
* the routine will return the next set of targets in the physical
* hierarchy. Conversely if the caller asks for ALL children targets
* for said source target, the routine will return all targets
- * contained within the processor chip.
+ * contained within the processor chip. All targets will be returned
+ * in depth first order.
*
* @param[out] o_list List of target handles that match the specified
- * criteria
- * @param[in] i_pTarget Target from which to search for other targets
+ * criteria. Caller's list will be cleared initially.
+ * @param[in] i_pTarget Target from which to search for other targets.
+ * Must not be NULL.
* @param[in] i_type Type of association linking the specified target
* to candidate result targets
* @param[in] i_recursionLevel Whether to return candidate targets
@@ -741,46 +740,6 @@ class TargetService
typedef std::vector< NodeSpecificInfo > NodeInfo_t;
/**
- * @brief Enum specifying which direction to traverse associations
- * between targets
- *
- * Given a general class of association between targets, this enum
- * tells the target service which direction to search along an entity
- * path for the result targets
- */
- enum ASSOCIATION_DIRECTION
- {
- INWARDS, ///< Search for associated targets of the specified target
- ///< that happen to be closer to the top level target
- OUTWARDS, ///< Search for associated targets of the specified target
- ///< that happen to be farther from the top level target
- };
-
- /**
- * @brief Structure mapping an association type to an entity path
- * attribute and entity path search direction
- *
- * This map allows the target service to accept an association type
- * from a caller and determine the appropriate entity path to search
- * along for the result target, and in which direction along the path
- */
- struct AssociationAttrMap
- {
- ASSOCIATION_TYPE associationType; ///< Specifies the type of
- ///< association to traverse
- ASSOCIATION_DIRECTION associationDir; ///< Specifies which
- ///< direction along an
- ///< entity path to search
- ATTRIBUTE_ID attr; ///< Specifies which entity
- ///< path to search along
- };
-
- /**
- * @brief Aliases a vector of association mappings
- */
- typedef std::vector< AssociationAttrMap > AssociationMappings_t;
-
- /**
* @brief Returns the first Target from the first initialized node
* from the pool of targets.
*
@@ -831,83 +790,56 @@ class TargetService
*/
void _maxTargets(NodeSpecificInfo & io_nodeInfoContainer);
+
+ //@NEBA
/**
- * @brief Returns handles to the targets associated to the
- * target represented by the specified entity path such that the
- * results are closer to the top level target than the source
- *
- * Returns handles to the targets associated to the target represented
- * by the specified entity path such that the results are closer to the
- * top level target than the source. An IMMEDIATE recursion level
- * returns handles to targets that are one association away from the
- * target referenced by the supplied entity path. A recursion level of
- * ALL recursively returns results.
- *
- * @param[in] i_attr Entity path attribute that is used as the basis
- * for lookups on candidate targets
- * @param[in] i_recursionLevel Whether to provide immediate or
- * recursive results
- * @param[in] i_entityPath Entity path to start search from
- * @param[in] i_pPredicate Pointer to a predicate to be evaluated
- * against each candidate target. If the predicate returns true,
- * the target will be added to the result list. A value of NULL
- * acts as a predicate that always returns true.
- * @param[out] o_list List of returned target handles
+ * @brief Returns handles targets associated to the specified target in
+ * a specific way as indicated by the input parameters. Returns
+ * results in depth first order.
*
- * @pre Target service must be initialized
+ * Returns handles to targets associated to the specified target,
+ * as indicated by an association type. Based on the specified
+ * recursion level, the routine will determine the immediate
+ * associations, or all possible associations. For example, if caller
+ * supplies a processor chip target and asks for its children targets,
+ * the routine will return the next set of targets in the physical
+ * hierarchy. Conversely if the caller asks for ALL children targets
+ * for said source target, the routine will return all targets
+ * contained within the processor chip. All searching is peformed as a
+ * depth first search. This routine will not clear the caller's input
+ * list when returning results.
*
- * @post List of target handles corresponding to targets closer to the
- * top level target than the one referenced by the specified entity
- * path returned
- */
- void _getInwards(
- ATTRIBUTE_ID i_attr,
- RECURSION_LEVEL i_recursionLevel,
- EntityPath i_entityPath,
- const PredicateBase* i_pPredicate,
- TargetHandleList& o_list) const;
-
- /**
- * @brief Returns handles to the targets associated to the
- * target represented by the specified entity path such that the
- * results are farther from the top level target than the source
- *
- * Returns handles to the targets associated to the target represented
- * by the specified entity path such that the results are farther from
- * the top level target than the source. An IMMEDIATE recursion level
- * returns handles to targets that are one association away from the
- * target referenced by the supplied entity path. A recursion level of
- * ALL recursively returns results.
- *
- * @param[in] i_attr Entity path attribute that is used as the basis
- * for lookups on candidate targets
- * @param[in] i_recursionLevel Whether to provide immediate or
- * recursive results
- * @param[in] i_entityPath Entity path to look from
- * @param[in] i_pPredicate Pointer to a predicate to be evaluated
- * against each candidate target. If the predicate returns true,
- * the target will be added to the result list. A value of NULL
- * acts as a predicate that always returns true.
- * @param[out] o_list List of returned target handles
+ * @param[out] o_list List of target handles that match the specified
+ * criteria, not cleared by this function.
+ * @param[in] i_pSourceTarget Target from which to search for other
+ * targets. Must not be NULL. Function presumes caller has
+ * already screened out NULL targets.
+ * @param[in] i_type Type of association linking the specified target
+ * to candidate result targets
+ * @param[in] i_recursionLevel Whether to return candidate targets
+ * immediately associated to the specified target or recursively
+ * associated to it.
+ * @param[in] i_pPredicate Pointer to a predicate to be evaluated
+ * against each candidate target (as determined by the source
+ * target, type, and recursion level parameters). If the predicate
+ * returns true, the target will be added to the result list. A
+ * value of NULL acts as a predicate that always returns true.
*
- * @pre Target service must be initialized
+ * @pre Input target must not be NULL
*
- * @post List of target handles corresponding to targets farther from
- * the top level target than the one referenced by the specified
- * entity path returned.
+ * @post List of target handles matching the specified criteria
+ * added to end of caller's list
*/
- void _getOutwards(
- ATTRIBUTE_ID i_attr,
- RECURSION_LEVEL i_recursionLevel,
- EntityPath i_entityPath,
- const PredicateBase* i_pPredicate,
- TargetHandleList& o_list ) const;
+ void _getAssociationsViaDfs(
+ TargetHandleList& o_list,
+ const Target* const i_pSourceTarget,
+ const ASSOCIATION_TYPE i_type,
+ const RECURSION_LEVEL i_recursionLevel,
+ const PredicateBase* const i_pPredicate) const;
// Instance variables
bool iv_initialized; ///< Is service initialized or not
- AssociationMappings_t iv_associationMappings; ///< Association map
-
NodeInfo_t iv_nodeInfo;
// Disable copy constructor / assignment operator
OpenPOWER on IntegriCloud