[DEVELOPMENT ENVIRONMENT]

* NEW: Some little redesign of the profiling GUI.

[EXAMPLES]
* OPT: Little optimization in GameOfLife example.

[INTERPRETER]
* NEW: System.Profile is a new property to disable or enable the
  profiling at run time. Profiling can only be enabled if debugging
  information are available.

[GB.DEBUG]
* NEW: Abort the program if the profile file is bigger than 512M.


git-svn-id: svn://localhost/gambas/trunk@4753 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-05-21 22:13:58 +00:00
parent 27a3b9a218
commit d356f49366
11 changed files with 347 additions and 268 deletions

View file

@ -10,32 +10,12 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: CComponentBox.class:221 FPropertyComponent.form:73
msgid "Experimental"
#: .project:1
msgid "Gambas 3"
msgstr ""
#: CComponentBox.class:223 FPropertyComponent.form:73
msgid "Not finished but stable"
msgstr ""
#: CComponentBox.class:235 ProjectItem.class:63
msgid "Authors"
msgstr ""
#: CComponentBox.class:242 FPropertyComponent.form:106 LibraryItem.class:63
msgid "Requires"
msgstr ""
#: CComponentBox.class:244
msgid "Excludes"
msgstr ""
#: CComponentBox.class:250
msgid "Implements"
msgstr ""
#: CComponentBox.class:263 LibraryItem.class:61
msgid "Provides"
#: .project:2
msgid "Integrated Development Environment for Gambas"
msgstr ""
#: CComponent.class:78
@ -302,6 +282,34 @@ msgstr ""
msgid "Loading information on component &1..."
msgstr ""
#: CComponentBox.class:221 FPropertyComponent.form:73
msgid "Experimental"
msgstr ""
#: CComponentBox.class:223 FPropertyComponent.form:73
msgid "Not finished but stable"
msgstr ""
#: CComponentBox.class:235 ProjectItem.class:63
msgid "Authors"
msgstr ""
#: CComponentBox.class:242 FPropertyComponent.form:106 LibraryItem.class:63
msgid "Requires"
msgstr ""
#: CComponentBox.class:244
msgid "Excludes"
msgstr ""
#: CComponentBox.class:250
msgid "Implements"
msgstr ""
#: CComponentBox.class:263 LibraryItem.class:61
msgid "Provides"
msgstr ""
#: CInsertColor.class:106 FEditor.form:414 FTextEditor.form:334
msgid "Insert color"
msgstr ""
@ -342,28 +350,28 @@ msgstr ""
msgid "Gambas reports"
msgstr ""
#: CProfile.class:104
#: CProfile.class:105
msgid "Evaluator"
msgstr ""
#: CProfile.class:106
#: CProfile.class:107
msgid "Event loop"
msgstr ""
#: CProjectTree.class:290 FMain.form:989 FSearch.class:98 FSelectIcon.form:31
#: Project.module:1617
#: Project.module:1621
msgid "Project"
msgstr ""
#: CProjectTree.class:293 Project.module:1620
#: CProjectTree.class:293 Project.module:1624
msgid "Sources"
msgstr ""
#: CProjectTree.class:296 Project.module:1623
#: CProjectTree.class:296 Project.module:1627
msgid "Connections"
msgstr ""
#: CProjectTree.class:305 Project.module:1632
#: CProjectTree.class:305 Project.module:1636
msgid "Data"
msgstr ""
@ -399,8 +407,8 @@ msgstr ""
#: FProxy.form:57 FReportBorderChooser.form:48 FReportBrushChooser.form:34
#: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28
#: FSaveProjectAs.form:76 FSearch.class:838 FSelectExtraFile.form:43
#: FSelectIcon.form:87 FSnippet.form:57 FTableChooser.form:68
#: FTextEditor.class:504 FText.form:41 FTranslate.class:636 Project.module:432
#: FSelectIcon.form:87 FSnippet.form:57 FTableChooser.form:68 FText.form:41
#: FTextEditor.class:504 FTranslate.class:636 Project.module:436
msgid "Cancel"
msgstr ""
@ -410,19 +418,19 @@ msgid ""
"the GNU General Public License."
msgstr ""
#: Design.module:149 Project.module:2027
#: Design.module:149 Project.module:2031
msgid "first"
msgstr ""
#: Design.module:151 Project.module:2029
#: Design.module:151 Project.module:2033
msgid "second"
msgstr ""
#: Design.module:153 Project.module:2031
#: Design.module:153 Project.module:2035
msgid "third"
msgstr ""
#: Design.module:241 Project.module:2090
#: Design.module:241 Project.module:2094
msgid "in &1:&2."
msgstr ""
@ -1291,7 +1299,7 @@ msgstr ""
msgid "Expression"
msgstr ""
#: FDebugInfo.class:55 FProfile.class:550
#: FDebugInfo.class:55 FProfile.class:548
msgid "Function"
msgstr ""
@ -1794,11 +1802,11 @@ msgstr ""
msgid "Help browser"
msgstr ""
#: FHelpBrowser.form:41 FMain.form:489 FProfile.form:50
#: FHelpBrowser.form:41 FMain.form:489 FProfile.form:55
msgid "Go back"
msgstr ""
#: FHelpBrowser.form:47 FMain.form:496 FProfile.form:56
#: FHelpBrowser.form:47 FMain.form:496 FProfile.form:61
msgid "Go forward"
msgstr ""
@ -1932,7 +1940,7 @@ msgstr ""
msgid "Import file"
msgstr ""
#: FImportTable.form:56 FPasteTable.form:40 FProfile.form:144
#: FImportTable.form:56 FPasteTable.form:40
msgid "Source"
msgstr ""
@ -2931,7 +2939,7 @@ msgid "There is no CHANGELOG entry for this release."
msgstr ""
#: FMakeInstall.class:348 FPropertyProject.class:837 FSave.form:21
#: Project.module:3154
#: Project.module:3158
msgid "Continue"
msgstr ""
@ -3063,7 +3071,7 @@ msgstr ""
msgid "This menu is too deep !"
msgstr ""
#: FMenu.class:947 Project.module:5109
#: FMenu.class:947 Project.module:5113
msgid "modified"
msgstr ""
@ -3563,70 +3571,38 @@ msgstr ""
msgid "Table already exists"
msgstr ""
#: FProfile.form:62
#: FProfile.form:67
msgid "Show relative durations"
msgstr ""
#: FProfile.form:120
#: FProfile.form:129
msgid "Callees"
msgstr ""
#: FProfile.form:132
#: FProfile.form:141
msgid "Callers"
msgstr ""
#: FProfile.class:366
#: FProfile.class:346
msgid "Profile &1"
msgstr ""
#: FProfile.class:366
#: FProfile.class:346
msgid "Total time &1 μs"
msgstr ""
#: FProfile.class:552
#: FProfile.class:550
msgid "Calls"
msgstr ""
#: FProfile.class:554
#: FProfile.class:552
msgid "Duration"
msgstr ""
#: FProfile.class:556
#: FProfile.class:554
msgid "Self"
msgstr ""
#: FPropertyComponent.form:66
msgid "Component advancement"
msgstr ""
#: FPropertyComponent.form:73
msgid "Finished and stable"
msgstr ""
#: FPropertyComponent.form:84
msgid "This component is hidden"
msgstr ""
#: FPropertyComponent.form:97
msgid "Exported classes"
msgstr ""
#: FPropertyComponent.form:111
msgid "Features"
msgstr ""
#: FPropertyComponent.form:152 FPropertyProject.form:495
msgid "Components"
msgstr ""
#: FPropertyComponent.form:196
msgid "Remove All"
msgstr ""
#: FPropertyComponent.class:149
msgid "Cannot write component description file."
msgstr ""
#: FProperty.form:40
msgid "Click on a form or a control to modify its properties..."
msgstr ""
@ -3682,6 +3658,38 @@ msgstr ""
msgid "Select a file"
msgstr ""
#: FPropertyComponent.form:66
msgid "Component advancement"
msgstr ""
#: FPropertyComponent.form:73
msgid "Finished and stable"
msgstr ""
#: FPropertyComponent.form:84
msgid "This component is hidden"
msgstr ""
#: FPropertyComponent.form:97
msgid "Exported classes"
msgstr ""
#: FPropertyComponent.form:111
msgid "Features"
msgstr ""
#: FPropertyComponent.form:152 FPropertyProject.form:495
msgid "Components"
msgstr ""
#: FPropertyComponent.form:196
msgid "Remove All"
msgstr ""
#: FPropertyComponent.class:149
msgid "Cannot write component description file."
msgstr ""
#: FPropertyProject.form:115
msgid "GB_GUI=gb.qt4"
msgstr ""
@ -4165,6 +4173,14 @@ msgstr ""
msgid "Choose a table"
msgstr ""
#: FText.form:12
msgid "Edit text property"
msgstr ""
#: FText.form:30
msgid "Use a fixed font"
msgstr ""
#: FTextEditor.form:182
msgid "Compress file"
msgstr ""
@ -4185,14 +4201,6 @@ msgstr ""
msgid "Unable to compress file."
msgstr ""
#: FText.form:12
msgid "Edit text property"
msgstr ""
#: FText.form:30
msgid "Use a fixed font"
msgstr ""
#: FTips.form:18
msgid "Tips of the day"
msgstr ""
@ -5695,18 +5703,6 @@ msgstr ""
msgid "'tar' has returned the following error code:"
msgstr ""
#: ProjectItem.class:63
msgid "Author"
msgstr ""
#: .project:1
msgid "Gambas 3"
msgstr ""
#: .project:2
msgid "Integrated Development Environment for Gambas"
msgstr ""
#: Project.module:188
msgid "Automation"
msgstr ""
@ -5755,271 +5751,275 @@ msgstr ""
msgid "Multimedia"
msgstr ""
#: Project.module:411
#: Project.module:415
msgid "This project does not exist."
msgstr ""
#: Project.module:426
#: Project.module:430
msgid "This is not a Gambas project."
msgstr ""
#: Project.module:429
#: Project.module:433
msgid "This is a Gambas 1.0 project. Use Gambas 2 to convert it."
msgstr ""
#: Project.module:432
#: Project.module:436
msgid ""
"This is a Gambas 2.0 project.\n"
"\n"
"Do you want to convert it?"
msgstr ""
#: Project.module:432
#: Project.module:436
msgid "Convert"
msgstr ""
#: Project.module:444
#: Project.module:448
msgid ""
"This project seems to be already opened.\n"
"\n"
"Opening the same project twice can lead to data loss."
msgstr ""
#: Project.module:444
#: Project.module:448
msgid "Open after all"
msgstr ""
#: Project.module:444
#: Project.module:448
msgid "Do not open"
msgstr ""
#: Project.module:470
#: Project.module:474
msgid "This project is read-only."
msgstr ""
#: Project.module:470
#: Project.module:474
msgid "It cannot be converted."
msgstr ""
#: Project.module:488
#: Project.module:492
msgid "Copying project inside a temporary directory..."
msgstr ""
#: Project.module:491
#: Project.module:495
msgid "Unable to create temporary directory"
msgstr ""
#: Project.module:512
#: Project.module:516
msgid "Converting project structure..."
msgstr ""
#: Project.module:541
#: Project.module:545
msgid "Applying conversion..."
msgstr ""
#: Project.module:547
#: Project.module:551
msgid "Unable to apply conversion"
msgstr ""
#: Project.module:636
#: Project.module:640
msgid "Cannot open project file :\n"
msgstr ""
#: Project.module:1351
#: Project.module:1355
msgid "The following classes have circular inheritance:"
msgstr ""
#: Project.module:1514
#: Project.module:1518
msgid "read-only"
msgstr ""
#: Project.module:1516
#: Project.module:1520
msgid "ALPHA VERSION, USE AT YOUR OWN RISK! :-)"
msgstr ""
#: Project.module:1781
#: Project.module:1785
msgid "Loading &1..."
msgstr ""
#: Project.module:1830
#: Project.module:1834
msgid "Cannot open a binary file."
msgstr ""
#: Project.module:1863
#: Project.module:1867
msgid "Cannot open file."
msgstr ""
#: Project.module:1921
#: Project.module:1925
msgid "File not found!"
msgstr ""
#: Project.module:2033
#: Project.module:2037
msgid "&1th"
msgstr ""
#: Project.module:2086
#: Project.module:2090
msgid "in form definition"
msgstr ""
#: Project.module:2093
#: Project.module:2097
msgid "in &1."
msgstr ""
#: Project.module:2248
#: Project.module:2252
msgid ""
"Some project source files are in conflict.\n"
"Please solve them if you want to compile the project."
msgstr ""
#: Project.module:2252
#: Project.module:2256
msgid "Compiling project"
msgstr ""
#: Project.module:2268
#: Project.module:2272
msgid "Nothing to do."
msgstr ""
#: Project.module:2467
#: Project.module:2471
msgid "File already exists."
msgstr ""
#: Project.module:2500
#: Project.module:2504
msgid "Directory already exists."
msgstr ""
#: Project.module:2512
#: Project.module:2516
msgid "Cannot link template file."
msgstr ""
#: Project.module:2518
#: Project.module:2522
msgid "Cannot copy template file."
msgstr ""
#: Project.module:2729
#: Project.module:2733
msgid "Making executable..."
msgstr ""
#: Project.module:2773
#: Project.module:2777
msgid "Cannot make executable."
msgstr ""
#: Project.module:3153
#: Project.module:3157
msgid "Some components are missing: &1"
msgstr ""
#: Project.module:3347
#: Project.module:3351
msgid "Cannot write project file."
msgstr ""
#: Project.module:3390
#: Project.module:3394
msgid "Unable to create desktop shortcut."
msgstr ""
#: Project.module:3636
#: Project.module:3640
msgid "The directory will be removed at the next commit."
msgstr ""
#: Project.module:3653
#: Project.module:3657
msgid "You must define a startup class or form!"
msgstr ""
#: Project.module:3684
#: Project.module:3688
msgid "Please type a name."
msgstr ""
#: Project.module:3688
#: Project.module:3692
msgid "This name contains a forbidden character:"
msgstr ""
#: Project.module:3692
#: Project.module:3696
msgid "The name cannot begins with a dot."
msgstr ""
#: Project.module:3696
#: Project.module:3700
msgid "This name is already used. Choose another one."
msgstr ""
#: Project.module:3732
#: Project.module:3736
msgid ""
"A class name must begin with a letter or an underscore, followed by any "
"letter or digit."
msgstr ""
#: Project.module:3780
#: Project.module:3784
msgid "Destination already exists"
msgstr ""
#: Project.module:3993
#: Project.module:3997
msgid "Unable to rename '&1'"
msgstr ""
#: Project.module:4109
#: Project.module:4113
msgid "Please type a project name."
msgstr ""
#: Project.module:4117
#: Project.module:4121
msgid "The project name cannot begin with a dot."
msgstr ""
#: Project.module:4120
#: Project.module:4124
msgid "Non-ASCII characters are forbidden in a project name."
msgstr ""
#: Project.module:4121
#: Project.module:4125
msgid ""
"The following characters are forbidden in a project name: ? * / \\ SPACE"
msgstr ""
#: Project.module:4128
#: Project.module:4132
msgid "This project already exists."
msgstr ""
#: Project.module:4131
#: Project.module:4135
msgid "The project directory already exists."
msgstr ""
#: Project.module:4133
#: Project.module:4137
msgid ""
"The project directory cannot be created because a file with the same name "
"already exists."
msgstr ""
#: Project.module:4185
#: Project.module:4189
msgid "Create source package"
msgstr ""
#: Project.module:4186
#: Project.module:4190
msgid "Source packages"
msgstr ""
#: Project.module:4477
#: Project.module:4481
msgid "Cannot copy file &1."
msgstr ""
#: Project.module:4526
#: Project.module:4530
msgid "Cannot create link &1."
msgstr ""
#: Project.module:4543
#: Project.module:4547
msgid "Cannot move a directory inside itself."
msgstr ""
#: Project.module:4611
#: Project.module:4615
msgid "Cannot move file &1."
msgstr ""
#: Project.module:5263
#: Project.module:5267
msgid "Project cleanup..."
msgstr ""
#: Project.module:5269
#: Project.module:5273
msgid "Project files conversion..."
msgstr ""
#: Project.module:5299
#: Project.module:5303
msgid "Unable to convert &1"
msgstr ""
#: ProjectItem.class:63
msgid "Author"
msgstr ""
#: Save.module:39
msgid "Cannot save file !"
msgstr ""

View file

@ -2,6 +2,7 @@
# Compiled with Gambas 3.1.90
Title=Gambas 3
Startup=Project
Profiling=1
Icon=img/logo/logo-ide.png
Version=3.1.90
VersionFile=1

View file

@ -8,6 +8,7 @@ Public Count As Integer
Public Time As Long
Property Read Self As Long
Public FirstTime As Long
Public MaxTime As Long
Public Called As New Collection
Public CalledList As New CProfile[]

View file

@ -106,6 +106,7 @@ Public Sub Init(sPath As String)
Dim iCount As Integer
Dim aSplitLine As String[]
Dim I, N As Integer
Dim iMax As Long
Inc Application.Busy
@ -333,27 +334,6 @@ Public Sub Init(sPath As String)
Next
' aSplitLine = Split(sLine, ",")
'
' For I = 0 To aSplitLine.Max Step 2
'
' iLine += CInt(aSplitLine[I])
' iLastTime = iOldTime
' Try iTime += CLong(aSplitLine[I + 1])
' iOldTime = iTime
'
' Dec iLastLine
' Try aLine[iLastLine] += iTime - iLastTime
' If Not Error Then
' Inc aCount[iLastLine]
' Else
' If iLastLine >= 0 Then Debug hCurrent.Name; "."; iLastLine + 1
' Endif
'
' iLastLine = iLine
'
' Next
Endif
Endif
@ -475,6 +455,9 @@ Private Sub LoadCurrentSourceCode() As String
Dim aWhere As String[]
Dim sPath As String
Dim sSource As String
Dim aDuration As Long[]
Dim iTime As Long
Dim I As Integer
aWhere = Split($hCurrent.Name, "*.*")
@ -497,15 +480,28 @@ Private Sub LoadCurrentSourceCode() As String
$iFirstLine = $hCurrent.StartLine
edtSource.Text = $hCurrent.Code
If $hCurrent.MaxTime = 0 Then
aDuration = $cLines[$sCurrentClass]
For I = $iFirstLine To $iFirstLine + edtSource.Lines.Count - 1
Try iTime = Max(iTime, aDuration[I])
Next
$hCurrent.MaxTime = iTime
Endif
gvwSource.Rows.Height = edtSource.LineHeight
gvwSource.Rows.Count = edtSource.Lines.Count
gvwSource.Refresh
tabInfo[2].Visible = True
panSourceHeader.H = gvwSource.Columns.Height - 1
panSource.Show
Return
HIDE_SOURCE:
tabInfo[2].Visible = False
panSource.Hide
End
@ -522,6 +518,7 @@ Public Sub Form_Close()
$aAll.Remove($aAll.Find($sPath))
Settings.Write(Me)
Settings.Write(splSource)
Settings.Write(splProfile)
End
@ -536,13 +533,14 @@ Public Sub ReadConfig()
panSepSource.Background = edtSource.Styles[Highlight.Background].Color
Project.SetEditorFont(gvwSource)
gvwSource.Width = gvwSource.Font.TextWidth("999999") * 4
End
Public Sub Form_Open()
Settings.Read(Me)
Settings.Read(splProfile)
Settings.Read(splSource)
ReadConfig
With gvwProfile
@ -585,9 +583,12 @@ Public Sub Form_Open()
With gvwSource
.Columns.Count = 2
.Columns.Resizable = False
.Columns[0].Text = ("Duration")
.Columns[0].Alignment = Align.Right
.Columns[0].Expand = True
.Columns[1].Alignment = Align.Left
.Columns[1].Text = ("Calls")
.Columns[1].Alignment = Align.Right
.Columns[1].Expand = True
End With
@ -792,27 +793,43 @@ Public Sub gvwCaller_Activate()
End
Private Sub GetDurationColor(fPercent As Float) As Integer
Dim iCol As Integer
iCol = 255 - fPercent * 64
Return Color.RGB(iCol, iCol, iCol)
End
Public Sub gvwSource_Data(Row As Integer, Column As Integer)
Dim iTime As Long
Dim iCount As Integer
'If Not $hCurrent Then Return
'Debug $hCurrent.Name; "."; Row + $iFirstLine; ": "; $hCurrent.Lines[Row + $iFirstLine]
If Row = 0 Then
iTime = $hCurrent.FirstTime
Else
Try iTime = $cLines[$sCurrentClass][Row + $iFirstLine]
Endif
With gvwSource.Data
Try .Background = GetDurationColor(iTime / $hCurrent.MaxTime)
Select Case Column
Case 0
If Row = 0 Then
iTime = $hCurrent.FirstTime
Else
Try iTime = $cLines[$sCurrentClass][Row + $iFirstLine]
If iTime = 0 Then
Try iCount = $cCount[$sCurrentClass][Row + $iFirstLine]
If iCount <= 1 Then Return
Endif
If iTime = 0 Then
Try iCount = $cCount[$sCurrentClass][Row + $iFirstLine]
If iCount <= 1 Then Return
Endif
If $bPercent Then
.Text = Format(iTime / $hCurrent.Time * 100, "0.00")
Else
@ -820,6 +837,7 @@ Public Sub gvwSource_Data(Row As Integer, Column As Integer)
Endif
Case 1
If Row = 0 Then
iCount = $hCurrent.Count
Else
@ -827,11 +845,11 @@ Public Sub gvwSource_Data(Row As Integer, Column As Integer)
Endif
If iCount <= 1 Then Return
.Text = "/ " & CStr(iCount)
.Text = CStr(iCount) & " "
End Select
End With
'If Row And 1 Then gvwSource.Data.Background = Color.LightForeground
End

View file

@ -1,12 +1,12 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,85,48)
MoveScaled(0,0,85,52)
Icon = Picture["icon:/medium/clock"]
Utility = True
Arrangement = Arrange.Fill
{ splProfile HSplit
MoveScaled(1,1,78,45)
MoveScaled(1,1,78,50)
Expand = True
{ Panel3 HBox
MoveScaled(1,6,35,34)
@ -47,16 +47,16 @@
}
}
{ Separator2 Separator
MoveScaled(32,7,0,23)
MoveScaled(33,1,0,32)
}
}
{ Panel1 HBox
MoveScaled(38,2,38,41)
MoveScaled(38,1,38,48)
{ Separator1 Separator
MoveScaled(2,10,0,24)
}
{ panCurrent VBox
MoveScaled(4,3,33,37)
MoveScaled(4,1,33,46)
Visible = False
Expand = True
{ lblCurrent TextLabel
@ -69,62 +69,79 @@
{ Separator3 Separator
MoveScaled(4,6,16,0)
}
{ tabInfo TabPanel
MoveScaled(2,7,29,29)
{ splSource VSplit
MoveScaled(1,7,31,38)
Expand = True
Arrangement = Arrange.Fill
Border = False
Count = 3
Index = 0
Text = ("Callees")
{ gvwCalled GridView
MoveScaled(2,1,19,23)
Mode = Select.Single
Header = GridView.Horizontal
ScrollBar = Scroll.Vertical
{ tabInfo TabPanel
MoveScaled(1,2,29,17)
Expand = True
Arrangement = Arrange.Fill
Border = False
AutoResize = False
Sorted = True
Count = 2
Index = 0
Text = ("Callees")
{ gvwCalled GridView
MoveScaled(2,1,27,11)
Mode = Select.Single
Header = GridView.Horizontal
ScrollBar = Scroll.Vertical
Border = False
AutoResize = False
Sorted = True
}
Index = 1
Text = ("Callers")
{ gvwCaller GridView
MoveScaled(1,2,27,11)
Mode = Select.Single
Header = GridView.Horizontal
ScrollBar = Scroll.Vertical
Border = False
AutoResize = False
Sorted = True
}
Index = 0
}
Index = 1
Text = ("Callers")
{ gvwCaller GridView
MoveScaled(2,2,19,23)
Mode = Select.Single
Header = GridView.Horizontal
ScrollBar = Scroll.Vertical
Border = False
AutoResize = False
Sorted = True
}
Index = 2
Text = ("Source")
{ HBox1 HBox
MoveScaled(1,1,27,24)
{ panSource HBox
MoveScaled(1,20,29,17)
{ gvwSource GridView
MoveScaled(1,1,7,22)
MoveScaled(1,1,7,14)
Mode = Select.Single
Grid = False
Header = GridView.Horizontal
ScrollBar = Scroll.None
Border = False
}
{ Separator4 Separator
MoveScaled(9,3,0,16)
MoveScaled(9,1,0,14)
}
{ panSepSource Panel
MoveScaled(10,2,1,21)
Background = Color.TextBackground
}
{ edtSource Editor
MoveScaled(12,1,14,22)
{ Panel4 VBox
MoveScaled(10,1,18,15)
Expand = True
Border = False
ScrollBar = Scroll.Vertical
Highlight = Highlight.Gambas
ReadOnly = True
{ panSourceHeader Panel
MoveScaled(2,1,10,1)
}
{ Separator6 Separator
MoveScaled(2,3,11,0)
}
{ Panel5 HBox
MoveScaled(1,4,16,10)
Expand = True
{ panSepSource Panel
MoveScaled(2,1,1,8)
Background = Color.TextBackground
}
{ edtSource Editor
MoveScaled(4,1,11,8)
Expand = True
Border = False
ScrollBar = Scroll.Vertical
Highlight = Highlight.Gambas
ReadOnly = True
}
}
}
}
Index = 0
}
}
}

View file

@ -237,6 +237,8 @@ Public Sub Main()
Application.Theme = "gambas"
End Select
System.Profile = False
'DB.Debug = True
OUTPUT_FILE = Temp$()
@ -275,6 +277,8 @@ Public Sub Main()
Return
Endif
System.Profile = True
InitVersion
InitWebView
'CRecentFile.Load

View file

@ -2,6 +2,7 @@
# Compiled with Gambas 3.1.90
Title=Game of Life
Startup=FMain
Profiling=1
Icon=glob2-icon-48x48.png
Version=3.1.90
VersionFile=1

View file

@ -18,10 +18,10 @@ SearchComment=False
SearchString=True
[OpenFile]
Active=1
File[1]=".src/FMain.form"
Active=2
File[2]=".src/FMain.class:7.12"
File[3]=".src/CGameField.class:74.12"
File[3]=".src/CGameField.class:168.0"
Count=3
[Watches]

View file

@ -137,19 +137,19 @@ Private Function CountNeighboursOnBorder(x As Integer, y As Integer) As Integer
End
Private Function CountNeighbours(x As Integer, y As Integer) As Integer
Dim iTot As Integer
iTot = Game[x - 1, y - 1] + Game[x, y - 1] + Game[x + 1, y - 1] +
Game[x - 1, y] + Game[x + 1, y] +
Game[x - 1, y + 1] + Game[x, y + 1] + Game[x + 1, y + 1]
iTot -= Color.White * 8
'DEBUG iTot / (Color.Red - Color.Background)
Return iTot \ (Color.Red - Color.White)
End
' Private Function CountNeighbours(x As Integer, y As Integer) As Integer
'
' Dim iTot As Integer
'
' iTot = Game[x - 1, y - 1] + Game[x, y - 1] + Game[x + 1, y - 1] +
' Game[x - 1, y] + Game[x + 1, y] +
' Game[x - 1, y + 1] + Game[x, y + 1] + Game[x + 1, y + 1]
'
' iTot -= Color.White * 8
' 'DEBUG iTot / (Color.Red - Color.Background)
' Return iTot \ (Color.Red - Color.White)
'
' End
Public Sub SpawnNextGeneration(Live As Boolean[], Keep As Boolean[])
@ -158,12 +158,22 @@ Public Sub SpawnNextGeneration(Live As Boolean[], Keep As Boolean[])
Dim i, j As Integer
Dim myCount As Integer
Dim newGame As Image
Dim myCountSub As Integer = Color.White * 8
newgame = Game.Copy()
For x = 1 To MaxX - 1
For y = 1 To MaxY - 1
myCount = CountNeighbours(x, y)
'myCount = CountNeighbours(x, y)
myCount = Game[x - 1, y - 1] + Game[x, y - 1] + Game[x + 1, y - 1] +
Game[x - 1, y] + Game[x + 1, y] +
Game[x - 1, y + 1] + Game[x, y + 1] + Game[x + 1, y + 1]
myCount -= myCountSub
myCount \= (Color.Red - Color.White)
If keep[myCount] Then Continue
If live[myCount]
newGame[x, y] = Color.Red

View file

@ -200,11 +200,14 @@ BEGIN_PROPERTY(System_Shell)
END_PROPERTY
/*BEGIN_METHOD_VOID(System_ClearMemoryCache)
BEGIN_PROPERTY(System_Profile)
MEMORY_clear_cache();
if (READ_PROPERTY)
GB_ReturnBoolean(EXEC_profile);
else if (EXEC_debug)
EXEC_profile = VPROP(GB_BOOLEAN);
END_METHOD*/
END_PROPERTY
#endif
@ -232,6 +235,8 @@ GB_DESC NATIVE_System[] =
GB_STATIC_PROPERTY("Language", "s", System_Language),
GB_STATIC_PROPERTY("FirstDayOfWeek", "i", System_FirstDayOfWeek),
GB_STATIC_PROPERTY("Shell", "s", System_Shell),
GB_STATIC_PROPERTY("Profile", "b", System_Profile),
GB_STATIC_PROPERTY_READ("RightToLeft", "b", System_RightToLeft),
GB_STATIC_PROPERTY_READ("Charset", "s", System_Charset),
GB_STATIC_PROPERTY_READ("Host", "s", System_Host),
@ -243,7 +248,6 @@ GB_DESC NATIVE_System[] =
GB_CONSTANT("Architecture", "s", ARCHITECTURE),
GB_STATIC_METHOD("GetExternSymbol", "p", System_GetExternSymbol, "(Library)s(Symbol)s"),
//GB_STATIC_METHOD("ClearMemoryCache", NULL, System_ClearMemoryCache, NULL),
GB_STATIC_PROPERTY_SELF("User", "User"),

View file

@ -30,10 +30,15 @@
#include "debug.h"
#include "main.h"
// Maximum profile file is 512 M
#define MAX_PROFILE_SIZE (512 << 20)
static bool _init = FALSE;
static FILE *_file;
static int _last_line = 0;
static bool _new_line = TRUE;
static int _count = 0;
static uint64_t get_time(void)
{
@ -83,6 +88,18 @@ void PROFILE_exit(void)
fclose(_file);
}
static void check_size()
{
_count = 0;
if (ftell(_file) > MAX_PROFILE_SIZE)
{
fprintf(stderr, "gb.profile: maximum profile size reached (512M)\n");
PROFILE_exit();
abort();
}
}
#define CODE(n) (n + '9' + 1)
static void add_line(ushort line, uint64_t time)
@ -126,6 +143,9 @@ static void add_line(ushort line, uint64_t time)
_last_line = line;
_new_line = FALSE;
_count++;
if ((_count & 0xFFFFF) == 0)
check_size();
}
void PROFILE_add(void *cp, void *fp, void *pc)
@ -150,6 +170,9 @@ void PROFILE_begin(void *cp, void *fp)
_last_line = 0;
_new_line = TRUE;
_count++;
if ((_count & 0xFFFFF) == 0)
check_size();
/*if (cp && fp)
{
FUNCTION *ffp = (FUNCTION *)fp;