當前位置: 首頁>>代碼示例>>C++>>正文


C++ ACPI_MEM_TRACKING函數代碼示例

本文整理匯總了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);
}
開發者ID:MarginC,項目名稱:kame,代碼行數:53,代碼來源:utalloc.c

示例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
}
開發者ID:Antonio-Zhou,項目名稱:Linux-2.6.11,代碼行數:51,代碼來源:utalloc.c

示例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);
    }
開發者ID:CoryXie,項目名稱:BarrelfishOS,代碼行數:50,代碼來源:utcache.c

示例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));
}
開發者ID:mikuhatsune001,項目名稱:linux2.6.32,代碼行數:35,代碼來源:nsalloc.c

示例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;
}
開發者ID:DangerDexter,項目名稱:FreeBSD-8.0-dyntick,代碼行數:60,代碼來源:nsalloc.c

示例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);
}
開發者ID:2asoft,項目名稱:freebsd,代碼行數:34,代碼來源:nsalloc.c

示例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 {
開發者ID:3sOx,項目名稱:asuswrt-merlin,代碼行數:46,代碼來源:utcache.c

示例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);
	}
開發者ID:Antonio-Zhou,項目名稱:Linux-2.6.11,代碼行數:45,代碼來源:utalloc.c

示例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);
    }
開發者ID:kame,項目名稱:kame,代碼行數:45,代碼來源:utalloc.c

示例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;
}
開發者ID:GodFox,項目名稱:magx_kernel_xpixl,代碼行數:56,代碼來源:nsalloc.c

示例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));
}
開發者ID:2asoft,項目名稱:freebsd,代碼行數:52,代碼來源:nsalloc.c

示例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);
}
開發者ID:CoryXie,項目名稱:BarrelfishOS,代碼行數:51,代碼來源:utcache.c

示例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));
}
開發者ID:avagin,項目名稱:linux,代碼行數:49,代碼來源:nsalloc.c

示例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);
}
開發者ID:laitianli,項目名稱:kernel-analyze_linux-2.6.18,代碼行數:23,代碼來源:nsalloc.c

示例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);
}
開發者ID:3sOx,項目名稱:asuswrt-merlin,代碼行數:45,代碼來源:utcache.c


注:本文中的ACPI_MEM_TRACKING函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。