Fix and add.
This commit is contained in:
parent
6aa9b8d708
commit
fbb2a97ce5
@ -147,5 +147,37 @@
|
|||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "test.c"
|
||||||
|
timestampString = "554017478.314317"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "64"
|
||||||
|
endingLineNumber = "64"
|
||||||
|
landmarkName = "tree"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "tree/tree_expand.c"
|
||||||
|
timestampString = "554017478.3148969"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "60"
|
||||||
|
endingLineNumber = "60"
|
||||||
|
landmarkName = "printTNode"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
</Breakpoints>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
@ -348,4 +348,15 @@ List *m_findByStringForNode(List* p_list, char *temp) {
|
|||||||
|
|
||||||
List *m_findByPointerForNode(List* p_list, void *temp) {
|
List *m_findByPointerForNode(List* p_list, void *temp) {
|
||||||
return mply_findByValue(p_list, POINTER, (void *)temp);
|
return mply_findByValue(p_list, POINTER, (void *)temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long calListMemory(List * p_list){
|
||||||
|
Node *p_node = p_list->head;
|
||||||
|
unsigned long long nodes_size = 0LL;
|
||||||
|
unsigned long long list_size = sizeof(p_list);
|
||||||
|
while(p_node != NULL){
|
||||||
|
nodes_size += sizeof(p_node) + sizeof(*p_node->value);
|
||||||
|
p_node = p_node->next;
|
||||||
|
}
|
||||||
|
return list_size + nodes_size;
|
||||||
}
|
}
|
||||||
|
@ -36,5 +36,7 @@ char *getByStringForNode(Node *);//直接得到节点的值
|
|||||||
void *getByPointerForNode(Node *);//直接得到节点的值
|
void *getByPointerForNode(Node *);//直接得到节点的值
|
||||||
unsigned long long getIndexByNode(List *p_list,Node *p_node);
|
unsigned long long getIndexByNode(List *p_list,Node *p_node);
|
||||||
int listThrough(List *p_list, int (*p_func)(int , void *));//遍历链表并不断调用目标函数。目标函数将接受节点储存值的指针及其类型。
|
int listThrough(List *p_list, int (*p_func)(int , void *));//遍历链表并不断调用目标函数。目标函数将接受节点储存值的指针及其类型。
|
||||||
|
|
||||||
|
unsigned long long calListMemory(List *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -211,4 +211,17 @@ int printTree(Tree *p_tree) {
|
|||||||
printf("Tree(id: %llu)",p_tree->id);
|
printf("Tree(id: %llu)",p_tree->id);
|
||||||
printTNodeWithFamily(p_tree->root,0);
|
printTNodeWithFamily(p_tree->root,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long long tnodes_size = 0LL;
|
||||||
|
|
||||||
|
unsigned long long calTreeMemory(Tree *p_tree){
|
||||||
|
tnodes_size = 0LL;
|
||||||
|
TreeThroughDown(p_tree, _doCalTreeMemory);
|
||||||
|
return sizeof(p_tree) + tnodes_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _doCalTreeMemory(TNode *p_tnode, unsigned long long height){
|
||||||
|
tnodes_size += sizeof(p_tnode) + sizeof(*p_tnode->value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -17,5 +17,8 @@ int printTree(Tree *p_tree);
|
|||||||
int printTNodeWithHome(TNode *p_tnode, int priority);
|
int printTNodeWithHome(TNode *p_tnode, int priority);
|
||||||
int printTNodeWithFamily(TNode *p_tnode, int priority);
|
int printTNodeWithFamily(TNode *p_tnode, int priority);
|
||||||
int printTNode(TNode *p_tnode, int priority);
|
int printTNode(TNode *p_tnode, int priority);
|
||||||
|
|
||||||
|
unsigned long long calTreeMemory(Tree *);
|
||||||
|
int _doCalTreeMemory(TNode *p_tnode, unsigned long long height);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user