Skip to content

Commit 3eb09cb

Browse files
Remove ActivateProfileColour
1 parent bb4d9ab commit 3eb09cb

File tree

3 files changed

+2
-149
lines changed

3 files changed

+2
-149
lines changed

doc/ref/debug.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,6 @@ Profiles are transformed into a human-readable form with
839839
<#Include Label="CoverageLineByLine">
840840
<#Include Label="UnprofileLineByLine">
841841
<#Include Label="UncoverageLineByLine">
842-
<#Include Label="ActivateProfileColour">
843842
<#Include Label="IsLineByLineProfileActive">
844843

845844

lib/newprofile.g

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,3 @@ end);
153153
BIND_GLOBAL("UncoverageLineByLine", function()
154154
return DEACTIVATE_PROFILING();
155155
end);
156-
157-
158-
#############################################################################
159-
##
160-
##
161-
## <#GAPDoc Label="ActivateProfileColour">
162-
## <ManSection>
163-
## <Func Name="ActivateProfileColour" Arg=""/>
164-
##
165-
## <Description>
166-
## Called with argument <K>true</K>,
167-
## <Ref Func="ActivateProfileColour"/>
168-
## makes GAP colour functions when printing them to show which lines
169-
## have been executed while profiling was active via
170-
## <Ref Func="ProfileLineByLine" /> at any time during this GAP session.
171-
## Passing <K>false</K> disables this behaviour.
172-
## </Description>
173-
## </ManSection>
174-
## <#/GAPDoc>
175-
BIND_GLOBAL("ActivateProfileColour",function(b)
176-
return ACTIVATE_COLOR_PROFILING(b);
177-
end);

src/profile.c

Lines changed: 2 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@
8383
** we provide -P (profiling) and -c (code coverage) options to the GAP
8484
** executable so the user can start before code loading starts
8585
**
86-
** 3) Operating at just a line basis can sometimes be too course. We can
87-
** see this when we use ActivateProfileColour. However, without some
88-
** serious additional overheads, I can't see how to provide this
86+
** 3) Operating at just a line basis can sometimes be too course. However,
87+
** without some serious additional overheads, I can't see how to provide this
8988
** functionality in output (basically we would have to store
9089
** line and character positions for the start and end of every expression).
9190
**
@@ -836,128 +835,6 @@ static Obj FuncIsLineByLineProfileActive(Obj self)
836835
}
837836
}
838837

839-
/****************************************************************************
840-
**
841-
** We are now into the functions which deal with colouring printing output.
842-
** This code basically wraps all the existing print functions and will colour
843-
** their output either green or red depending on if statements are marked
844-
** as being executed.
845-
*/
846-
847-
static Int CurrentColour = 0;
848-
849-
static void setColour(void)
850-
{
851-
if(CurrentColour == 0) {
852-
Pr("\x1b[0m", 0, 0);
853-
}
854-
else if(CurrentColour == 1) {
855-
Pr("\x1b[32m", 0, 0);
856-
}
857-
else if(CurrentColour == 2) {
858-
Pr("\x1b[31m", 0, 0);
859-
}
860-
}
861-
862-
static void ProfilePrintStatPassthrough(Stat stat)
863-
{
864-
Int SavedColour = CurrentColour;
865-
if (visitedStat(stat)) {
866-
CurrentColour = 1;
867-
}
868-
else {
869-
CurrentColour = 2;
870-
}
871-
setColour();
872-
OriginalPrintStatFuncsForHook[TNUM_STAT(stat)](stat);
873-
CurrentColour = SavedColour;
874-
setColour();
875-
}
876-
877-
static void ProfilePrintExprPassthrough(Expr stat)
878-
{
879-
Int SavedColour = -1;
880-
/* There are two cases we must pass through without touching */
881-
/* From TNUM_EXPR */
882-
if(IS_REF_LVAR(stat)) {
883-
OriginalPrintExprFuncsForHook[EXPR_REF_LVAR](stat);
884-
} else if(IS_INTEXPR(stat)) {
885-
OriginalPrintExprFuncsForHook[EXPR_INT](stat);
886-
} else {
887-
SavedColour = CurrentColour;
888-
if (visitedStat(stat)) {
889-
CurrentColour = 1;
890-
}
891-
else {
892-
CurrentColour = 2;
893-
}
894-
setColour();
895-
OriginalPrintExprFuncsForHook[TNUM_STAT(stat)](stat);
896-
CurrentColour = SavedColour;
897-
setColour();
898-
}
899-
}
900-
901-
static struct PrintHooks profilePrintHooks =
902-
{ProfilePrintStatPassthrough, ProfilePrintExprPassthrough};
903-
904-
static Obj activate_colored_output_from_profile(void)
905-
{
906-
HashLock(&profileState);
907-
908-
if(profileState.ColouringOutput) {
909-
HashUnlock(&profileState);
910-
return Fail;
911-
}
912-
913-
ActivatePrintHooks(&profilePrintHooks);
914-
915-
profileState.ColouringOutput = 1;
916-
CurrentColour = 0;
917-
setColour();
918-
919-
HashUnlock(&profileState);
920-
921-
return True;
922-
}
923-
924-
static Obj deactivate_colored_output_from_profile(void)
925-
{
926-
HashLock(&profileState);
927-
928-
if(!profileState.ColouringOutput) {
929-
HashUnlock(&profileState);
930-
return Fail;
931-
}
932-
933-
DeactivatePrintHooks(&profilePrintHooks);
934-
935-
profileState.ColouringOutput = 0;
936-
CurrentColour = 0;
937-
setColour();
938-
939-
HashUnlock(&profileState);
940-
941-
return True;
942-
}
943-
944-
static Obj FuncACTIVATE_COLOR_PROFILING(Obj self, Obj arg)
945-
{
946-
if(arg == True)
947-
{
948-
return activate_colored_output_from_profile();
949-
}
950-
else if(arg == False)
951-
{
952-
return deactivate_colored_output_from_profile();
953-
}
954-
else
955-
return Fail;
956-
}
957-
958-
959-
960-
961838
/****************************************************************************
962839
**
963840
*F * * * * * * * * * * * * * initialize module * * * * * * * * * * * * * * *
@@ -977,7 +854,6 @@ static StructGVarFunc GVarFuncs[] = {
977854
resolution),
978855
GVAR_FUNC_0ARGS(DEACTIVATE_PROFILING),
979856
GVAR_FUNC_0ARGS(IsLineByLineProfileActive),
980-
GVAR_FUNC_1ARGS(ACTIVATE_COLOR_PROFILING, arg),
981857
{ 0, 0, 0, 0, 0 }
982858
};
983859

0 commit comments

Comments
 (0)