Skip to content

Commit

Permalink
0.1.0-preview.5 - 2019/01/29
Browse files Browse the repository at this point in the history
@2018.3
  • Loading branch information
ErikMoczi committed Feb 6, 2019
1 parent 8629822 commit 9c08b0d
Show file tree
Hide file tree
Showing 70 changed files with 2,941 additions and 1,226 deletions.
17 changes: 17 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [0.1.0-preview.5] - 2019-01-29
### Added
- Added progress bar displays for actions like opening/importing snapshots.
- Restored binary compatibility with the 2017.4 memory snapshot format.
- Added handling for duplicate GC handles present in the snapshot.

### Changed
- Lowered the number of GC allocations when crawling a snapshot.
- Upgraded dependency on EditorCoroutines package to 0.0.2-preview.1.
- Changed the initialization of the managed memory sections to not overallocate.
- Fixed an issue where selecting a region on the memory map would expand the table underneath onto the whole window.
- Fixed an issue where closing either snapshot (with two snapshots loaded) would close the other one instead.
- Resolved UI issues with upstream UI elements versions.

### Removed
- Removed links in columns: Native Object Name, Native Size. For the Native Objects table.

## [0.1.0-preview.4] - 2019-01-02
### Added
- Added on demand computing for tables with the purpose of speeding up the snapshot opening process.
Expand Down
2 changes: 1 addition & 1 deletion package/Editor/Database/Column/Column.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public virtual long[] GetSortIndexAndEquality(SortOrder order, ArrayRange indice
public abstract long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher);
public abstract long GetFirstMatchIndex(Operation.Operator op, Operation.Expression exp, long expRowFirst);

public virtual Database.View.LinkRequest GetRowLink(long row) { return null; }
public virtual LinkRequest GetRowLink(long row) { return null; }

// will return -1 if the underlying data has not been computed yet.
// ComputeRowCount or Update should be called at least once before getting accurate row count
Expand Down
2 changes: 1 addition & 1 deletion package/Editor/Database/Column/ColumnError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void SetRowValue(long row, string value)
{
}

public override Database.View.LinkRequest GetRowLink(long row)
public override LinkRequest GetRowLink(long row)
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion package/Editor/Database/Column/ExpandColumnTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override long GetRowCount()
return m_Table.GetRowCount();
}

public override Database.View.LinkRequest GetRowLink(long row)
public override LinkRequest GetRowLink(long row)
{
var tableEntry = m_Table.m_RowData[row];
if (tableEntry.isGroupHead())
Expand Down
78 changes: 78 additions & 0 deletions package/Editor/Database/Link.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using Unity.MemoryProfiler.Editor.Debuging;

namespace Unity.MemoryProfiler.Editor.Database
{
// A request to open a link.
internal class LinkRequest
{
ParameterSet m_Parameters;
public ParameterSet Parameters
{
get
{
if (m_Parameters == null) m_Parameters = new ParameterSet();
return m_Parameters;
}
}
public bool HasParameters
{
get
{
return m_Parameters != null && m_Parameters.Count > 0;
}
}
}

// Definition of a link to a table
internal class TableLink
{
public string TableName;
public System.Collections.Generic.List<View.Where.Builder> RowWhere;
public System.Collections.Generic.Dictionary<string, string> Parameters;
public void SetParameter(string name, string value)
{
if (Parameters == null)
{
Parameters = new System.Collections.Generic.Dictionary<string, string>();
}
Parameters.Add(name, value);
}
}

// Request to open a link to a table
internal class LinkRequestTable : LinkRequest
{
public TableLink LinkToOpen;
public View.ViewTable SourceView;
public Table SourceTable;
public Column SourceColumn;
public long SourceRow;

public static LinkRequestTable MakeLinkRequest(TableLink metaLink, Table sourceTable, Column sourceColumn, long sourceRow, Database.Operation.ExpressionParsingContext expressionParsingContext)
{
if (metaLink == null) return null;
using (ScopeDebugContext.Func(() => { return "MakeLinkRequest from table '" + sourceTable.GetName() + "' row " + sourceRow; }))
{
var lr = new LinkRequestTable();
lr.LinkToOpen = metaLink;
lr.SourceTable = sourceTable;
lr.SourceView = sourceTable as View.ViewTable;
lr.SourceColumn = sourceColumn;
lr.SourceRow = sourceRow;

if (lr.LinkToOpen.Parameters != null)
{
foreach (var p in lr.LinkToOpen.Parameters)
{
var opt = new Operation.Expression.ParseIdentifierOption(sourceTable.Schema as View.ViewSchema, sourceTable, true, true, typeof(string), expressionParsingContext);
var metaExpression = new Operation.Expression.MetaExpression(p.Value, true);
var exp = Operation.Expression.ParseIdentifier(metaExpression, opt);
var exp2 = Operation.ColumnCreator.CreateTypedExpressionFixedRow(exp, sourceRow);
lr.Parameters.Add(p.Key, exp2);
}
}
return lr;
}
}
}
}
11 changes: 11 additions & 0 deletions package/Editor/Database/Link.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions package/Editor/Database/Operation/DiffTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,13 @@ public override void SetRowValue(long row, DataT value)
m_SourceColumn[tabI].SetRowValue(rowI, value);
}

public override Database.View.LinkRequest GetRowLink(long row)
public override LinkRequest GetRowLink(long row)
{
int tabI = m_Table.m_Entries[row].tableIndex;
long rowI = m_Table.m_Entries[row].rowIndex;
var link = m_SourceColumn[tabI].GetRowLink(rowI);
if (link == null) return null;
if (link.param == null)
{
link.param = new ParameterSet();
}
link.param.Add("snapshotindex", tabI);
link.Parameters.AddValue("snapshotindex", tabI);
return link;
}
}
Expand Down Expand Up @@ -381,7 +377,7 @@ protected void ComputeTables()
public override Table GetTableByName(string name, ParameterSet param)
{
int snapshotIndex;
if (param != null && param.TryGet("snapshotindex", out snapshotIndex))
if (param != null && param.TryGetValue("snapshotindex", out snapshotIndex))
{
Schema schema;
switch (snapshotIndex)
Expand All @@ -401,9 +397,9 @@ public override Table GetTableByName(string name, ParameterSet param)
return GetTableByName(name);
}

public override Table GetTableByLink(TableLink link)
public override Table GetTableByReference(TableReference tableRef)
{
return GetTableByName(link.name, link.param);
return GetTableByName(tableRef.Name, tableRef.Param);
}
}
}
2 changes: 1 addition & 1 deletion package/Editor/Database/Operation/GroupedColumnTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override long GetRowCount()
return m_GroupTable.m_Groups.Length;
}

public override Database.View.LinkRequest GetRowLink(long row)
public override LinkRequest GetRowLink(long row)
{
var e = m_GroupTable.m_RowData[row];
if (e.isGroupHead())
Expand Down
8 changes: 4 additions & 4 deletions package/Editor/Database/Operation/Grouping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ internal interface IMergeAlgorithm
{
void Merge(Column destColumn, long destRow, Column sourceColumn, ArrayRange sourceIndices);
IComparable Merge(Column sourceColumn, ArrayRange sourceIndices);
Database.View.LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices);
LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices);

// Only display a value on merged rows. normal entries will display an empty string
bool IsDisplayMergedRowsOnly();
Expand Down Expand Up @@ -362,12 +362,12 @@ public IComparable Merge(Column sourceColumn, ArrayRange sourceIndices)
return GroupTyped(sourceColumn as ColumnTyped<DataT>, sourceIndices);
}

Database.View.LinkRequest IMergeAlgorithm.GetLink(Column sourceColumn, ArrayRange sourceIndices)
LinkRequest IMergeAlgorithm.GetLink(Column sourceColumn, ArrayRange sourceIndices)
{
return this.GetLink(sourceColumn, sourceIndices);
}

protected virtual Database.View.LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices)
protected virtual LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices)
{
return null;
}
Expand Down Expand Up @@ -404,7 +404,7 @@ protected override IComparable GroupTyped(ColumnTyped<DataT> sourceColumn, Array
return sourceColumn.GetRowValue(sourceIndices[0]);
}

protected override Database.View.LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices)
protected override LinkRequest GetLink(Column sourceColumn, ArrayRange sourceIndices)
{
return sourceColumn.GetRowLink(sourceIndices[0]);
}
Expand Down
2 changes: 1 addition & 1 deletion package/Editor/Database/Operation/IndexedColumnTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void SetRowValue(long row, DataT value)
m_SourceColumn.SetRowValue(m_IndexedTable.indices[row], value);
}

public override Database.View.LinkRequest GetRowLink(long row)
public override LinkRequest GetRowLink(long row)
{
return m_SourceColumn.GetRowLink(m_IndexedTable.indices[row]);
}
Expand Down
65 changes: 65 additions & 0 deletions package/Editor/Database/Schema/ParameterSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace Unity.MemoryProfiler.Editor.Database
{
internal class ParameterSet
{
System.Collections.Generic.Dictionary<string, Operation.Expression> m_Parameters = new System.Collections.Generic.Dictionary<string, Operation.Expression>();
public int Count { get { return m_Parameters.Count; } }
public void Add(string key, Operation.Expression value)
{
m_Parameters.Add(key, value);
}

public bool TryGet(string key, out Operation.Expression value)
{
return m_Parameters.TryGetValue(key, out value);
}

public void AddValue<DataT>(string key, DataT value) where DataT : System.IComparable
{
m_Parameters.Add(key, new Operation.ExpConst<DataT>(value));
}

public bool TryGetValue<DataT>(string key, out DataT value) where DataT : System.IComparable
{
Operation.Expression exp;
if (m_Parameters.TryGetValue(key, out exp))
{
if (exp is Operation.ExpConst<DataT>)
{
value = (exp as Operation.ExpConst<DataT>).GetValue(0);
return true;
}
}
value = default(DataT);
return false;
}

public override string ToString()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("(");
bool needComma = false;
foreach (var p in m_Parameters)
{
if (needComma)
{
sb.Append(", ");
} else
{
needComma = true;
}
sb.AppendFormat("{0}={1}", p.Key, p.Value.GetValueString(0));
}
sb.Append(")");
return sb.ToString();
}

public System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Operation.Expression>> AllParameters
{
get
{
return m_Parameters;
}
}
}
}
11 changes: 11 additions & 0 deletions package/Editor/Database/Schema/ParameterSet.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9c08b0d

Please sign in to comment.