本文整理汇总了C++中ACPI_MEM_TRACKING函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_MEM_TRACKING函数的具体用法?C++ ACPI_MEM_TRACKING怎么用?C++ ACPI_MEM_TRACKING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_MEM_TRACKING函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AcpiUtAcquireFromCache
void *
AcpiUtAcquireFromCache (
UINT32 ListId)
{
ACPI_MEMORY_LIST *CacheInfo;
void *Object;
PROC_NAME ("UtAcquireFromCache");
CacheInfo = &AcpiGbl_MemoryLists[ListId];
AcpiUtAcquireMutex (ACPI_MTX_CACHES);
ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
/* Check the cache first */
if (CacheInfo->ListHead)
{
/* There is an object available, use it */
Object = CacheInfo->ListHead;
CacheInfo->ListHead = * (char **) (((char *) Object) + CacheInfo->LinkOffset);
ACPI_MEM_TRACKING (CacheInfo->CacheHits++);
CacheInfo->CacheDepth--;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
Object, AcpiGbl_MemoryLists[ListId].ListName));
#endif
AcpiUtReleaseMutex (ACPI_MTX_CACHES);
/* Clear (zero) the previously used Object */
MEMSET (Object, 0, CacheInfo->ObjectSize);
}
else
{
/* The cache is empty, create a new object */
/* Avoid deadlock with ACPI_MEM_CALLOCATE */
AcpiUtReleaseMutex (ACPI_MTX_CACHES);
Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
}
return (Object);
}
示例2: acpi_ut_release_to_cache
void
acpi_ut_release_to_cache (
u32 list_id,
void *object)
{
struct acpi_memory_list *cache_info;
ACPI_FUNCTION_ENTRY ();
cache_info = &acpi_gbl_memory_lists[list_id];
#ifdef ACPI_ENABLE_OBJECT_CACHE
/* If walk cache is full, just free this wallkstate object */
if (cache_info->cache_depth >= cache_info->max_cache_depth) {
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
}
/* Otherwise put this object back into the cache */
else {
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return;
}
/* Mark the object as cached */
ACPI_MEMSET (object, 0xCA, cache_info->object_size);
ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
* (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
cache_info->list_head = object;
cache_info->cache_depth++;
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
#else
/* Object cache is disabled; just free the object */
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
#endif
}
示例3: AcpiOsAcquireObject
void *
AcpiOsAcquireObject (
ACPI_MEMORY_LIST *Cache)
{
ACPI_STATUS Status;
void *Object;
ACPI_FUNCTION_NAME (OsAcquireObject);
if (!Cache)
{
return (NULL);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
return (NULL);
}
ACPI_MEM_TRACKING (Cache->Requests++);
/* Check the cache first */
if (Cache->ListHead)
{
/* There is an object available, use it */
Object = Cache->ListHead;
Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Object)[Cache->LinkOffset])));
Cache->CurrentDepth--;
ACPI_MEM_TRACKING (Cache->Hits++);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Object %p from %s cache\n", Object, Cache->ListName));
Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
return (NULL);
}
/* Clear (zero) the previously used Object */
ACPI_MEMSET (Object, 0, Cache->ObjectSize);
}
示例4: acpi_ns_delete_node
void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME(ns_delete_node);
/* Detach an object if there is one */
acpi_ns_detach_object(node);
/*
* Delete an attached data object if present (an object that was created
* and attached via acpi_attach_data). Note: After any normal object is
* detached above, the only possible remaining object is a data object.
*/
obj_desc = node->object;
if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
/* Invoke the attached data deletion handler if present */
if (obj_desc->data.handler) {
obj_desc->data.handler(node, obj_desc->data.pointer);
}
acpi_ut_remove_reference(obj_desc);
}
/* Now we can delete the node */
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
node, acpi_gbl_current_node_count));
}
示例5: AcpiNsDeleteNode
void
AcpiNsDeleteNode (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_NAMESPACE_NODE *PrevNode;
ACPI_NAMESPACE_NODE *NextNode;
ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node);
ParentNode = AcpiNsGetParentNode (Node);
PrevNode = NULL;
NextNode = ParentNode->Child;
/* Find the node that is the previous peer in the parent's child list */
while (NextNode != Node)
{
PrevNode = NextNode;
NextNode = PrevNode->Peer;
}
if (PrevNode)
{
/* Node is not first child, unlink it */
PrevNode->Peer = NextNode->Peer;
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST;
}
}
else
{
/* Node is first child (has no previous peer) */
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* No peers at all */
ParentNode->Child = NULL;
}
else
{ /* Link peer list to parent */
ParentNode->Child = NextNode->Peer;
}
}
ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
/* Detach an object if there is one, then delete the node */
AcpiNsDetachObject (Node);
(void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
return_VOID;
}
示例6: AcpiNsCreateNode
ACPI_NAMESPACE_NODE *
AcpiNsCreateNode (
UINT32 Name)
{
ACPI_NAMESPACE_NODE *Node;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
UINT32 Temp;
#endif
ACPI_FUNCTION_TRACE (NsCreateNode);
Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache);
if (!Node)
{
return_PTR (NULL);
}
ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
Temp = AcpiGbl_NsNodeList->TotalAllocated -
AcpiGbl_NsNodeList->TotalFreed;
if (Temp > AcpiGbl_NsNodeList->MaxOccupied)
{
AcpiGbl_NsNodeList->MaxOccupied = Temp;
}
#endif
Node->Name.Integer = Name;
ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
return_PTR (Node);
}
示例7: ACPI_FUNCTION_NAME
void *acpi_os_acquire_object(struct acpi_memory_list *cache)
{
acpi_status status;
void *object;
ACPI_FUNCTION_NAME(os_acquire_object);
if (!cache) {
return (NULL);
}
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
return (NULL);
}
ACPI_MEM_TRACKING(cache->requests++);
/* Check the cache first */
if (cache->list_head) {
/* There is an object available, use it */
object = cache->list_head;
cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char,
&(((char *)
object)[cache->
link_offset])));
cache->current_depth--;
ACPI_MEM_TRACKING(cache->hits++);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Object %p from %s cache\n", object,
cache->list_name));
status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
return (NULL);
}
/* Clear (zero) the previously used Object */
ACPI_MEMSET(object, 0, cache->object_size);
} else {
示例8: acpi_ut_acquire_from_cache
void *
acpi_ut_acquire_from_cache (
u32 list_id)
{
struct acpi_memory_list *cache_info;
void *object;
ACPI_FUNCTION_NAME ("ut_acquire_from_cache");
cache_info = &acpi_gbl_memory_lists[list_id];
#ifdef ACPI_ENABLE_OBJECT_CACHE
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
ACPI_MEM_TRACKING (cache_info->cache_requests++);
/* Check the cache first */
if (cache_info->list_head) {
/* There is an object available, use it */
object = cache_info->list_head;
cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset])));
ACPI_MEM_TRACKING (cache_info->cache_hits++);
cache_info->cache_depth--;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
object, acpi_gbl_memory_lists[list_id].list_name));
#endif
if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
/* Clear (zero) the previously used Object */
ACPI_MEMSET (object, 0, cache_info->object_size);
}
示例9: AcpiUtAcquireFromCache
void *
AcpiUtAcquireFromCache (
UINT32 ListId)
{
ACPI_MEMORY_LIST *CacheInfo;
void *Object;
ACPI_FUNCTION_NAME ("UtAcquireFromCache");
CacheInfo = &AcpiGbl_MemoryLists[ListId];
if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
{
return (NULL);
}
ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
/* Check the cache first */
if (CacheInfo->ListHead)
{
/* There is an object available, use it */
Object = CacheInfo->ListHead;
CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset])));
ACPI_MEM_TRACKING (CacheInfo->CacheHits++);
CacheInfo->CacheDepth--;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
Object, AcpiGbl_MemoryLists[ListId].ListName));
#endif
if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
{
return (NULL);
}
/* Clear (zero) the previously used Object */
ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize);
}
示例10: acpi_ns_delete_node
void
acpi_ns_delete_node (
struct acpi_namespace_node *node)
{
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *prev_node;
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node);
parent_node = acpi_ns_get_parent_node (node);
prev_node = NULL;
next_node = parent_node->child;
/* Find the node that is the previous peer in the parent's child list */
while (next_node != node) {
prev_node = next_node;
next_node = prev_node->peer;
}
if (prev_node) {
/* Node is not first child, unlink it */
prev_node->peer = next_node->peer;
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
}
}
else {
/* Node is first child (has no previous peer) */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* No peers at all */
parent_node->child = NULL;
}
else { /* Link peer list to parent */
parent_node->child = next_node->peer;
}
}
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
/*
* Detach an object if there is one then delete the node
*/
acpi_ns_detach_object (node);
ACPI_MEM_FREE (node);
return_VOID;
}
示例11: AcpiNsDeleteNode
void
AcpiNsDeleteNode (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *NextDesc;
ACPI_FUNCTION_NAME (NsDeleteNode);
/* Detach an object if there is one */
AcpiNsDetachObject (Node);
/*
* Delete an attached data object list if present (objects that were
* attached via AcpiAttachData). Note: After any normal object is
* detached above, the only possible remaining object(s) are data
* objects, in a linked list.
*/
ObjDesc = Node->Object;
while (ObjDesc &&
(ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
{
/* Invoke the attached data deletion handler if present */
if (ObjDesc->Data.Handler)
{
ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer);
}
NextDesc = ObjDesc->Common.NextObject;
AcpiUtRemoveReference (ObjDesc);
ObjDesc = NextDesc;
}
/* Special case for the statically allocated root node */
if (Node == AcpiGbl_RootNode)
{
return;
}
/* Now we can delete the node */
(void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
Node, AcpiGbl_CurrentNodeCount));
}
示例12: AcpiOsReleaseObject
ACPI_STATUS
AcpiOsReleaseObject (
ACPI_MEMORY_LIST *Cache,
void *Object)
{
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
if (!Cache || !Object)
{
return (AE_BAD_PARAMETER);
}
/* If cache is full, just free this object */
if (Cache->CurrentDepth >= Cache->MaxDepth)
{
ACPI_FREE (Object);
ACPI_MEM_TRACKING (Cache->TotalFreed++);
}
/* Otherwise put this object back into the cache */
else
{
Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Mark the object as cached */
ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
* (ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
Cache->ListHead = Object;
Cache->CurrentDepth++;
(void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
}
return (AE_OK);
}
示例13: acpi_ns_delete_node
void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *next_desc;
ACPI_FUNCTION_NAME(ns_delete_node);
if (!node) {
return_VOID;
}
/* Detach an object if there is one */
acpi_ns_detach_object(node);
/*
* Delete an attached data object list if present (objects that were
* attached via acpi_attach_data). Note: After any normal object is
* detached above, the only possible remaining object(s) are data
* objects, in a linked list.
*/
obj_desc = node->object;
while (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
/* Invoke the attached data deletion handler if present */
if (obj_desc->data.handler) {
obj_desc->data.handler(node, obj_desc->data.pointer);
}
next_desc = obj_desc->common.next_object;
acpi_ut_remove_reference(obj_desc);
obj_desc = next_desc;
}
/* Special case for the statically allocated root node */
if (node == acpi_gbl_root_node) {
return;
}
/* Now we can delete the node */
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
node, acpi_gbl_current_node_count));
}
示例14: ACPI_FUNCTION_TRACE
/**ltl
* 功能: 创建命名空间对象
* 参数:
* 返回值:
* 说明: 为命名空间名字赋值,同时设定标志ACPI_DESC_TYPE_NAMED
*/
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
{
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE(ns_create_node);
node = acpi_os_acquire_object(acpi_gbl_namespace_cache);
if (!node) {
return_PTR(NULL);
}
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
node->name.integer = name;
ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
return_PTR(node);
}
示例15: acpi_os_release_object
acpi_status
acpi_os_release_object(struct acpi_memory_list * cache, void *object)
{
acpi_status status;
ACPI_FUNCTION_ENTRY();
if (!cache || !object) {
return (AE_BAD_PARAMETER);
}
/* If cache is full, just free this object */
if (cache->current_depth >= cache->max_depth) {
ACPI_FREE(object);
ACPI_MEM_TRACKING(cache->total_freed++);
}
/* Otherwise put this object back into the cache */
else {
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Mark the object as cached */
ACPI_MEMSET(object, 0xCA, cache->object_size);
ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
/* Put the object at the head of the cache list */
*(ACPI_CAST_INDIRECT_PTR(char,
&(((char *)object)[cache->
link_offset]))) =
cache->list_head;
cache->list_head = object;
cache->current_depth++;
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
}
return (AE_OK);
}