1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

First version of Profiler

It is now possible to profile GDScript as well as some parts of Godot
internals.
This commit is contained in:
Juan Linietsky
2016-05-21 21:18:16 -03:00
parent c195c0df6b
commit a75f896338
35 changed files with 2245 additions and 180 deletions

View File

@@ -1310,9 +1310,9 @@ static void _find_identifiers_in_class(GDCompletionContext& context,bool p_stati
}
}
for (const Map<StringName,GDFunction>::Element *E=script->get_member_functions().front();E;E=E->next()) {
if (!p_static || E->get().is_static()) {
if (E->get().get_argument_count())
for (const Map<StringName,GDFunction*>::Element *E=script->get_member_functions().front();E;E=E->next()) {
if (!p_static || E->get()->is_static()) {
if (E->get()->get_argument_count())
result.insert(E->key().operator String()+"(");
else
result.insert(E->key().operator String()+"()");
@@ -1536,10 +1536,10 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
if (scr) {
while (scr) {
for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get().is_static() && p_method==E->get().get_name()) {
for (const Map<StringName,GDFunction*>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get()->is_static() && p_method==E->get()->get_name()) {
arghint="static func "+String(p_method)+"(";
for(int i=0;i<E->get().get_argument_count();i++) {
for(int i=0;i<E->get()->get_argument_count();i++) {
if (i>0)
arghint+=", ";
else
@@ -1547,12 +1547,12 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
if (i==p_argidx) {
arghint+=String::chr(0xFFFF);
}
arghint+="var "+E->get().get_argument_name(i);
int deffrom = E->get().get_argument_count()-E->get().get_default_argument_count();
arghint+="var "+E->get()->get_argument_name(i);
int deffrom = E->get()->get_argument_count()-E->get()->get_default_argument_count();
if (i>=deffrom) {
int defidx = deffrom-i;
if (defidx>=0 && defidx<E->get().get_default_argument_count()) {
arghint+="="+E->get().get_default_argument(defidx).get_construct_string();
if (defidx>=0 && defidx<E->get()->get_default_argument_count()) {
arghint+="="+E->get()->get_default_argument(defidx).get_construct_string();
}
}
if (i==p_argidx) {
@@ -1670,10 +1670,10 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
if (code=="") {
for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (p_method==E->get().get_name()) {
for (const Map<StringName,GDFunction*>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (p_method==E->get()->get_name()) {
arghint="func "+String(p_method)+"(";
for(int i=0;i<E->get().get_argument_count();i++) {
for(int i=0;i<E->get()->get_argument_count();i++) {
if (i>0)
arghint+=", ";
else
@@ -1681,12 +1681,12 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
if (i==p_argidx) {
arghint+=String::chr(0xFFFF);
}
arghint+="var "+E->get().get_argument_name(i);
int deffrom = E->get().get_argument_count()-E->get().get_default_argument_count();
arghint+="var "+E->get()->get_argument_name(i);
int deffrom = E->get()->get_argument_count()-E->get()->get_default_argument_count();
if (i>=deffrom) {
int defidx = deffrom-i;
if (defidx>=0 && defidx<E->get().get_default_argument_count()) {
arghint+="="+E->get().get_default_argument(defidx).get_construct_string();
if (defidx>=0 && defidx<E->get()->get_default_argument_count()) {
arghint+="="+E->get()->get_default_argument(defidx).get_construct_string();
}
}
if (i==p_argidx) {
@@ -1926,16 +1926,16 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
if (script.is_valid()) {
for (const Map<StringName,GDFunction>::Element *E=script->get_member_functions().front();E;E=E->next()) {
for (const Map<StringName,GDFunction*>::Element *E=script->get_member_functions().front();E;E=E->next()) {
if (E->key()==id->name) {
if (context.function && context.function->_static && !E->get().is_static())
if (context.function && context.function->_static && !E->get()->is_static())
continue;
arghint = "func "+id->name.operator String()+String("(");
for(int i=0;i<E->get().get_argument_count();i++) {
for(int i=0;i<E->get()->get_argument_count();i++) {
if (i>0)
arghint+=", ";
else
@@ -1943,12 +1943,12 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
if (i==p_argidx) {
arghint+=String::chr(0xFFFF);
}
arghint+=E->get().get_argument_name(i);
int deffrom = E->get().get_argument_count()-E->get().get_default_argument_count();
arghint+=E->get()->get_argument_name(i);
int deffrom = E->get()->get_argument_count()-E->get()->get_default_argument_count();
if (i>=deffrom) {
int defidx = deffrom-i;
if (defidx>=0 && defidx<E->get().get_default_argument_count()) {
arghint+="="+E->get().get_default_argument(defidx).get_construct_string();
if (defidx>=0 && defidx<E->get()->get_default_argument_count()) {
arghint+="="+E->get()->get_default_argument(defidx).get_construct_string();
}
}
if (i==p_argidx) {
@@ -1956,7 +1956,7 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
}
}
if (E->get().get_argument_count()>0)
if (E->get()->get_argument_count()>0)
arghint+=" ";
arghint+=")";
return;
@@ -2178,8 +2178,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
options.insert(E->key());
}
}
for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get().is_static())
for (const Map<StringName,GDFunction*>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get()->is_static())
options.insert(E->key());
}
@@ -2266,8 +2266,8 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
options.insert(E->key());
}
}
for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get().get_argument_count())
for (const Map<StringName,GDFunction*>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
if (E->get()->get_argument_count())
options.insert(String(E->key())+"()");
else
options.insert(String(E->key())+"(");