Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cdy816
Mars
提交
0f720e00
Mars
项目概览
cdy816
/
Mars
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0f720e00
编写于
5月 24, 2020
作者:
cdy816
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化无损压缩算法,提高压缩速度
上级
b56c8324
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
2369 addition
and
1783 deletion
+2369
-1783
Common/Cdy.Tag.Common/Common/CustomQueue.cs
Common/Cdy.Tag.Common/Common/CustomQueue.cs
+90
-0
Common/Cdy.Tag.Common/Common/MemoryBlock.cs
Common/Cdy.Tag.Common/Common/MemoryBlock.cs
+1
-1
Common/Cdy.Tag.Consume/Cdy.Tag.Consume.csproj
Common/Cdy.Tag.Consume/Cdy.Tag.Consume.csproj
+4
-0
Common/Cdy.Tag/His/CompressUnitManager.cs
Common/Cdy.Tag/His/CompressUnitManager.cs
+53
-1
Common/Cdy.Tag/His/CompressUnitbase.cs
Common/Cdy.Tag/His/CompressUnitbase.cs
+1
-0
Common/Cdy.Tag/Interface/HisQueryResult.cs
Common/Cdy.Tag/Interface/HisQueryResult.cs
+89
-0
Develop/DBStudio/Program.cs
Develop/DBStudio/Program.cs
+1
-0
Proxy/DBHighApi/DBHighApi.csproj
Proxy/DBHighApi/DBHighApi.csproj
+4
-0
RunTime/DBHisDataServer/DBHisDataServer.csproj
RunTime/DBHisDataServer/DBHisDataServer.csproj
+5
-0
RunTime/DBRuntime.Proxy/DBRuntime.Proxy.csproj
RunTime/DBRuntime.Proxy/DBRuntime.Proxy.csproj
+4
-0
RunTime/DBRuntime.Real/DBRuntime.Real.csproj
RunTime/DBRuntime.Real/DBRuntime.Real.csproj
+4
-0
RunTime/DBRuntime/His/Compress/CompressEnginer.cs
RunTime/DBRuntime/His/Compress/CompressEnginer.cs
+1
-1
RunTime/DBRuntime/His/Compress/CompressMemory.cs
RunTime/DBRuntime/His/Compress/CompressMemory.cs
+34
-17
RunTime/DBRuntime/His/Compress/Special/DeadAreaCompressUnit.cs
...me/DBRuntime/His/Compress/Special/DeadAreaCompressUnit.cs
+20
-20
RunTime/DBRuntime/His/Compress/Special/LosslessCompressUnit.cs
...me/DBRuntime/His/Compress/Special/LosslessCompressUnit.cs
+694
-638
RunTime/DBRuntime/His/Compress/Special/NoneCompressUnit.cs
RunTime/DBRuntime/His/Compress/Special/NoneCompressUnit.cs
+1139
-874
RunTime/DBRuntime/His/Compress/Special/SlopeCompressUnit.cs
RunTime/DBRuntime/His/Compress/Special/SlopeCompressUnit.cs
+225
-231
未找到文件。
Common/Cdy.Tag.Common/Common/CustomQueue.cs
0 → 100644
浏览文件 @
0f720e00
//==============================================================
// Copyright (C) 2020 Inc. All rights reserved.
//
//==============================================================
// Create by 种道洋 at 2020/5/23 23:58:40.
// Version 1.0
// 种道洋
//==============================================================
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Cdy.Tag
{
public
class
CustomQueue
<
T
>
{
#
region
...
Variables
...
private
T
[]
mColections
;
private
int
mCount
=
0
;
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
/// <summary>
///
/// </summary>
/// <param name="count"></param>
public
CustomQueue
(
int
count
)
{
mColections
=
new
T
[
count
];
mCount
=
count
;
}
#
endregion
...
Constructor
...
#
region
...
Properties
...
public
int
Index
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
/// <summary>
///
/// </summary>
/// <param name="value"></param>
public
void
Insert
(
T
value
)
{
Index
++;
mColections
[
Index
]
=
value
;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
T
Remove
()
{
Index
--;
if
(
Index
<
0
)
{
Index
=
-
1
;
return
default
(
T
);
}
else
{
return
mColections
[
Index
];
}
}
public
T
Get
(
int
index
)
{
return
mColections
[
index
];
}
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
}
Common/Cdy.Tag.Common/Common/MemoryBlock.cs
浏览文件 @
0f720e00
...
@@ -47,7 +47,7 @@ namespace Cdy.Tag
...
@@ -47,7 +47,7 @@ namespace Cdy.Tag
private
object
mUserSizeLock
=
new
object
();
private
object
mUserSizeLock
=
new
object
();
public
int
BufferItemSize
=
1024
*
1024
*
128
;
public
int
BufferItemSize
=
1024
*
1024
*
4
;
public
static
byte
[]
zoreData
=
new
byte
[
1024
*
10
];
public
static
byte
[]
zoreData
=
new
byte
[
1024
*
10
];
...
...
Common/Cdy.Tag.Consume/Cdy.Tag.Consume.csproj
浏览文件 @
0f720e00
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cdy.Tag\Cdy.Tag.csproj" />
<ProjectReference Include="..\Cdy.Tag\Cdy.Tag.csproj" />
</ItemGroup>
</ItemGroup>
...
...
Common/Cdy.Tag/His/CompressUnitManager.cs
浏览文件 @
0f720e00
...
@@ -26,11 +26,18 @@ namespace Cdy.Tag
...
@@ -26,11 +26,18 @@ namespace Cdy.Tag
/// </summary>
/// </summary>
private
Dictionary
<
int
,
CompressUnitbase
>
mCompressUnit
=
new
Dictionary
<
int
,
CompressUnitbase
>();
private
Dictionary
<
int
,
CompressUnitbase
>
mCompressUnit
=
new
Dictionary
<
int
,
CompressUnitbase
>();
/// <summary>
///
/// </summary>
private
Dictionary
<
int
,
Queue
<
CompressUnitbase
>>
mPoolCompressUnits
=
new
Dictionary
<
int
,
Queue
<
CompressUnitbase
>>();
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
public
static
CompressUnitManager
Manager
=
new
CompressUnitManager
();
public
static
CompressUnitManager
Manager
=
new
CompressUnitManager
();
#
endregion
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
region
...
Events
...
...
@@ -54,7 +61,52 @@ namespace Cdy.Tag
...
@@ -54,7 +61,52 @@ namespace Cdy.Tag
/// <returns></returns>
/// <returns></returns>
public
CompressUnitbase
GetCompress
(
int
type
)
public
CompressUnitbase
GetCompress
(
int
type
)
{
{
return
mCompressUnit
.
ContainsKey
(
type
)
?
mCompressUnit
[
type
]
:
null
;
lock
(
mPoolCompressUnits
)
{
if
(
mCompressUnit
.
ContainsKey
(
type
))
{
if
(
mPoolCompressUnits
.
ContainsKey
(
type
)
&&
mPoolCompressUnits
[
type
].
Count
>
0
)
{
return
mPoolCompressUnits
[
type
].
Dequeue
();
}
else
{
return
mCompressUnit
[
type
].
Clone
();
}
}
}
return
null
;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public
CompressUnitbase
GetCompressQuick
(
int
type
)
{
return
mCompressUnit
.
ContainsKey
(
type
)?
mCompressUnit
[
type
]:
null
;
}
/// <summary>
///
/// </summary>
/// <param name="compress"></param>
public
void
ReleaseCompress
(
CompressUnitbase
compress
)
{
lock
(
mPoolCompressUnits
)
{
if
(
mPoolCompressUnits
.
ContainsKey
(
compress
.
TypeCode
))
{
mPoolCompressUnits
[
compress
.
TypeCode
].
Enqueue
(
compress
);
}
else
{
var
dd
=
new
Queue
<
CompressUnitbase
>();
dd
.
Enqueue
(
compress
);
mPoolCompressUnits
.
Add
(
compress
.
TypeCode
,
dd
);
}
}
}
}
/// <summary>
/// <summary>
...
...
Common/Cdy.Tag/His/CompressUnitbase.cs
浏览文件 @
0f720e00
...
@@ -91,6 +91,7 @@ namespace Cdy.Tag
...
@@ -91,6 +91,7 @@ namespace Cdy.Tag
#
region
...
Methods
...
#
region
...
Methods
...
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
...
Common/Cdy.Tag/Interface/HisQueryResult.cs
浏览文件 @
0f720e00
...
@@ -838,6 +838,95 @@ namespace Cdy.Tag
...
@@ -838,6 +838,95 @@ namespace Cdy.Tag
AddPoint
(
value
.
X
,
value
.
Y
,
value
.
Z
,
time
,
qulity
);
AddPoint
(
value
.
X
,
value
.
Y
,
value
.
Z
,
time
,
qulity
);
}
}
/// <summary>
///
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public
T
GetValue
(
int
index
)
{
object
re
=
null
;
switch
(
mDataType
)
{
case
0
:
re
=
Convert
.
ToBoolean
(
MemoryHelper
.
ReadByte
((
void
*)
handle
,
index
));
break
;
case
1
:
re
=
MemoryHelper
.
ReadByte
((
void
*)
handle
,
index
);
break
;
case
2
:
re
=
MemoryHelper
.
ReadShort
((
void
*)
handle
,
index
*
2
);
break
;
case
3
:
re
=
MemoryHelper
.
ReadShort
((
void
*)
handle
,
index
*
2
);
break
;
case
4
:
re
=
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
4
);
break
;
case
5
:
re
=
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
4
);
break
;
case
6
:
re
=
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
8
);
break
;
case
7
:
re
=
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
8
);
break
;
case
8
:
re
=
MemoryHelper
.
ReadFloat
((
void
*)
handle
,
index
*
4
);
break
;
case
9
:
re
=
MemoryHelper
.
ReadDouble
((
void
*)
handle
,
index
*
8
);
break
;
case
10
:
re
=
MemoryHelper
.
ReadDateTime
((
void
*)
handle
,
index
*
8
);
break
;
case
11
:
int
cc
=
0
;
int
pos
=
0
;
while
(
true
)
{
if
(
cc
>=
index
)
{
break
;
}
//pos += (mDataBuffer[pos]+1);
pos
+=
MemoryHelper
.
ReadByte
((
void
*)
handle
,
pos
)
+
1
;
cc
++;
}
re
=
new
string
((
char
*)
handle
,
pos
+
1
,
MemoryHelper
.
ReadByte
((
void
*)
handle
,
pos
));
break
;
case
12
:
var
x
=
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
8
);
var
y
=
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
8
+
4
);
re
=
new
IntPointData
(
x
,
y
);
break
;
case
13
:
re
=
new
UIntPointData
(
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
8
),
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
8
+
4
));
break
;
case
14
:
re
=
new
IntPoint3Data
(
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
12
),
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
12
+
4
),
MemoryHelper
.
ReadInt32
((
void
*)
handle
,
index
*
12
+
8
));
break
;
case
15
:
re
=
new
UIntPoint3Data
(
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
12
),
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
12
+
4
),
MemoryHelper
.
ReadUInt32
((
void
*)
handle
,
index
*
12
+
8
));
break
;
case
16
:
re
=
new
LongPointData
(
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
16
),
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
16
+
8
));
break
;
case
17
:
re
=
new
ULongPointData
(
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
16
),
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
16
+
8
));
break
;
case
18
:
re
=
new
LongPoint3Data
(
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
24
),
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
24
+
8
),
MemoryHelper
.
ReadInt64
((
void
*)
handle
,
index
*
24
+
16
));
break
;
case
19
:
re
=
new
ULongPoint3Data
(
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
24
),
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
24
+
8
),
MemoryHelper
.
ReadUInt64
((
void
*)
handle
,
index
*
24
+
16
));
break
;
}
return
(
T
)
re
;
}
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
...
Develop/DBStudio/Program.cs
浏览文件 @
0f720e00
...
@@ -396,6 +396,7 @@ namespace DBStudio
...
@@ -396,6 +396,7 @@ namespace DBStudio
{
{
StringBuilder
re
=
new
StringBuilder
();
StringBuilder
re
=
new
StringBuilder
();
re
.
AppendLine
();
re
.
AppendLine
();
re
.
AppendLine
(
"save // save database "
);
re
.
AppendLine
(
"start // start database "
);
re
.
AppendLine
(
"start // start database "
);
re
.
AppendLine
(
"restart // restart database "
);
re
.
AppendLine
(
"restart // restart database "
);
re
.
AppendLine
(
"stop // stop database "
);
re
.
AppendLine
(
"stop // stop database "
);
...
...
Proxy/DBHighApi/DBHighApi.csproj
浏览文件 @
0f720e00
...
@@ -9,6 +9,10 @@
...
@@ -9,6 +9,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\Cdy.Tag.Common\Cdy.Tag.Common.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Common\Cdy.Tag.Common.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag\Cdy.Tag.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag\Cdy.Tag.csproj" />
...
...
RunTime/DBHisDataServer/DBHisDataServer.csproj
浏览文件 @
0f720e00
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\Cdy.Tag.Common\Cdy.Tag.Common.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Common\Cdy.Tag.Common.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Network\Cdy.Tag.Network.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Network\Cdy.Tag.Network.csproj" />
...
...
RunTime/DBRuntime.Proxy/DBRuntime.Proxy.csproj
浏览文件 @
0f720e00
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\Cdy.Tag.Driver\Cdy.Tag.Driver.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Driver\Cdy.Tag.Driver.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Network\Cdy.Tag.Network.csproj" />
<ProjectReference Include="..\..\Common\Cdy.Tag.Network\Cdy.Tag.Network.csproj" />
...
...
RunTime/DBRuntime.Real/DBRuntime.Real.csproj
浏览文件 @
0f720e00
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)\Output" /y
if exist "$(TargetDir)$(TargetName).XML" copy "$(TargetDir)$(TargetName).XML" "$(SolutionDir)\Output\Xml" /y
if exist "$(TargetDir)$(TargetName).pdb" copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)\Output" /y
copy "$(TargetDir)Config\*.cfg" "$(SolutionDir)\Output\Config" /y
if exist "$(TargetDir)zh-CN" copy "$(TargetDir)zh-CN\*.dll" "$(SolutionDir)\Output\zh-CN" /y
" />
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)\Output" /y
if exist "$(TargetDir)$(TargetName).XML" copy "$(TargetDir)$(TargetName).XML" "$(SolutionDir)\Output\Xml" /y
if exist "$(TargetDir)$(TargetName).pdb" copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)\Output" /y
copy "$(TargetDir)Config\*.cfg" "$(SolutionDir)\Output\Config" /y
if exist "$(TargetDir)zh-CN" copy "$(TargetDir)zh-CN\*.dll" "$(SolutionDir)\Output\zh-CN" /y
" />
</Target>
</Target>
...
...
RunTime/DBRuntime/His/Compress/CompressEnginer.cs
浏览文件 @
0f720e00
...
@@ -102,7 +102,7 @@ namespace Cdy.Tag
...
@@ -102,7 +102,7 @@ namespace Cdy.Tag
}
}
}
}
long
psize
=
mTotalSize
/
mTargetMemorys
.
Count
;
long
psize
=
(
long
)(
mTotalSize
*
1.5
)
/
mTargetMemorys
.
Count
;
System
.
Threading
.
Tasks
.
Parallel
.
ForEach
(
mTargetMemorys
,
(
vv
)
=>
{
System
.
Threading
.
Tasks
.
Parallel
.
ForEach
(
mTargetMemorys
,
(
vv
)
=>
{
vv
.
Value
.
ReAlloc
(
vv
.
Value
.
HeadSize
+
psize
);
vv
.
Value
.
ReAlloc
(
vv
.
Value
.
HeadSize
+
psize
);
...
...
RunTime/DBRuntime/His/Compress/CompressMemory.cs
浏览文件 @
0f720e00
...
@@ -28,6 +28,8 @@ namespace Cdy.Tag
...
@@ -28,6 +28,8 @@ namespace Cdy.Tag
private
Dictionary
<
int
,
Tuple
<
long
,
int
,
int
,
int
>>
mTagAddress
;
private
Dictionary
<
int
,
Tuple
<
long
,
int
,
int
,
int
>>
mTagAddress
;
private
DateTime
mCurrentTime
;
private
DateTime
mCurrentTime
;
private
IHisEngine
mHisTagService
;
private
IHisEngine
mHisTagService
;
private
Dictionary
<
int
,
CompressUnitbase
>
mCompressCach
=
new
Dictionary
<
int
,
CompressUnitbase
>();
private
Dictionary
<
int
,
long
>
dtmp
=
new
Dictionary
<
int
,
long
>();
#
endregion
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
region
...
Events
...
...
@@ -67,6 +69,8 @@ namespace Cdy.Tag
...
@@ -67,6 +69,8 @@ namespace Cdy.Tag
/// </summary>
/// </summary>
public
static
int
TagCountPerMemory
{
get
;
set
;
}
public
static
int
TagCountPerMemory
{
get
;
set
;
}
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
@@ -120,14 +124,15 @@ namespace Cdy.Tag
...
@@ -120,14 +124,15 @@ namespace Cdy.Tag
#
region
...
Methods
...
#
region
...
Methods
...
/// <summary>
///// <summary>
///
/////
/// </summary>
///// </summary>
public
void
ResetTagAddress
()
//public void ResetTagAddress()
{
//{
mTagAddress
.
Clear
();
// mTagAddress.Clear();
mTagAddress
=
null
;
// mTagAddress = null;
}
// mCompressCach.Clear();
//}
/// <summary>
/// <summary>
///
///
...
@@ -135,12 +140,20 @@ namespace Cdy.Tag
...
@@ -135,12 +140,20 @@ namespace Cdy.Tag
/// <param name="sourceM"></param>
/// <param name="sourceM"></param>
private
void
CheckTagAddress
(
MergeMemoryBlock
sourceM
)
private
void
CheckTagAddress
(
MergeMemoryBlock
sourceM
)
{
{
if
(
mTagAddress
==
null
&&
sourceM
!=
null
)
if
(
mTagAddress
==
null
&&
sourceM
!=
null
)
{
{
mTagAddress
=
new
Dictionary
<
int
,
Tuple
<
long
,
int
,
int
,
int
>>();
mTagAddress
=
new
Dictionary
<
int
,
Tuple
<
long
,
int
,
int
,
int
>>();
dtmp
.
Clear
();
foreach
(
var
vv
in
sourceM
.
TagAddress
.
Where
(
e
=>
e
.
Key
>=
Id
*
TagCountPerMemory
&&
e
.
Key
<(
Id
+
1
)*
TagCountPerMemory
))
foreach
(
var
vv
in
sourceM
.
TagAddress
.
Where
(
e
=>
e
.
Key
>=
Id
*
TagCountPerMemory
&&
e
.
Key
<(
Id
+
1
)*
TagCountPerMemory
))
{
{
mTagAddress
.
Add
(
vv
.
Key
,
vv
.
Value
);
mTagAddress
.
Add
(
vv
.
Key
,
vv
.
Value
);
dtmp
.
Add
(
vv
.
Key
,
0
);
var
cpt
=
mHisTagService
.
GetHisTag
(
vv
.
Key
).
CompressType
;
if
(!
mCompressCach
.
ContainsKey
(
cpt
))
{
mCompressCach
.
Add
(
cpt
,
CompressUnitManager
.
Manager
.
GetCompressQuick
(
cpt
).
Clone
());
}
}
}
}
}
}
}
...
@@ -165,16 +178,15 @@ namespace Cdy.Tag
...
@@ -165,16 +178,15 @@ namespace Cdy.Tag
int
headOffset
=
4
+
4
;
int
headOffset
=
4
+
4
;
long
Offset
=
headOffset
+
this
.
mTagAddress
.
Count
*
8
;
long
Offset
=
headOffset
+
this
.
mTagAddress
.
Count
*
8
;
Dictionary
<
int
,
long
>
dtmp
=
new
Dictionary
<
int
,
long
>();
this
.
MakeMemoryBusy
();
this
.
MakeMemoryBusy
();
long
ltmp1
=
sw
.
ElapsedMilliseconds
;
//更新数据区域
//更新数据区域
foreach
(
var
vv
in
mTagAddress
)
foreach
(
var
vv
in
mTagAddress
)
{
{
var
size
=
CompressBlockMemory
(
source
,
vv
.
Value
.
Item1
,
Offset
,
vv
.
Value
.
Item3
,
vv
.
Value
.
Item4
,
vv
.
Key
);
var
size
=
CompressBlockMemory
(
source
,
vv
.
Value
.
Item1
,
Offset
,
vv
.
Value
.
Item3
,
vv
.
Value
.
Item4
,
vv
.
Key
);
dtmp
.
Add
(
vv
.
Key
,
Offset
)
;
dtmp
[
vv
.
Key
]=
Offset
;
Offset
+=
size
;
Offset
+=
size
;
datasize
+=
size
;
datasize
+=
size
;
}
}
...
@@ -183,6 +195,8 @@ namespace Cdy.Tag
...
@@ -183,6 +195,8 @@ namespace Cdy.Tag
this
.
WriteInt
(
0
,(
int
)
datasize
);
this
.
WriteInt
(
0
,(
int
)
datasize
);
this
.
Write
((
int
)
this
.
mTagAddress
.
Count
);
this
.
Write
((
int
)
this
.
mTagAddress
.
Count
);
long
ltmp2
=
sw
.
ElapsedMilliseconds
;
int
count
=
0
;
int
count
=
0
;
foreach
(
var
vv
in
dtmp
)
foreach
(
var
vv
in
dtmp
)
{
{
...
@@ -191,10 +205,12 @@ namespace Cdy.Tag
...
@@ -191,10 +205,12 @@ namespace Cdy.Tag
count
+=
8
;
count
+=
8
;
}
}
long
ltmp3
=
sw
.
ElapsedMilliseconds
;
ServiceLocator
.
Locator
.
Resolve
<
IDataSerialize
>().
RequestToSeriseFile
(
this
,
mCurrentTime
);
ServiceLocator
.
Locator
.
Resolve
<
IDataSerialize
>().
RequestToSeriseFile
(
this
,
mCurrentTime
);
sw
.
Stop
();
sw
.
Stop
();
LoggerService
.
Service
.
Info
(
"CompressEnginer"
,
Id
+
"压缩完成 耗时:"
+
sw
.
ElapsedMilliseconds
);
LoggerService
.
Service
.
Info
(
"CompressEnginer"
,
Id
+
"压缩完成 耗时:"
+
sw
.
ElapsedMilliseconds
+
" ltmp1:"
+
ltmp1
+
" ltmp2:"
+(
ltmp2
-
ltmp1
)+
" ltmp3:"
+(
ltmp3
-
ltmp2
),
ConsoleColor
.
Red
);
}
}
/// <summary>
/// <summary>
...
@@ -219,12 +235,12 @@ namespace Cdy.Tag
...
@@ -219,12 +235,12 @@ namespace Cdy.Tag
var
comtype
=
histag
.
CompressType
;
//压缩类型
var
comtype
=
histag
.
CompressType
;
//压缩类型
this
.
CheckAndResize
(
targetPosition
+
len
);
//
this.CheckAndResize(targetPosition + len);
//写入压缩类型
//写入压缩类型
this
.
WriteByte
(
targetPosition
+
4
,
(
byte
)
comtype
);
this
.
WriteByte
(
targetPosition
+
4
,
(
byte
)
comtype
);
var
tp
=
CompressUnitManager
.
Manager
.
GetCompress
(
comtype
)
;
var
tp
=
mCompressCach
[
comtype
]
;
if
(
tp
!=
null
)
if
(
tp
!=
null
)
{
{
tp
.
QulityOffset
=
(
int
)
qulityoffset
;
tp
.
QulityOffset
=
(
int
)
qulityoffset
;
...
@@ -235,6 +251,7 @@ namespace Cdy.Tag
...
@@ -235,6 +251,7 @@ namespace Cdy.Tag
var
size
=
tp
.
Compress
(
mSourceMemory
,
addr
,
this
,
targetPosition
+
5
,
len
)
+
1
;
var
size
=
tp
.
Compress
(
mSourceMemory
,
addr
,
this
,
targetPosition
+
5
,
len
)
+
1
;
this
.
WriteInt
(
targetPosition
,
(
int
)
size
);
this
.
WriteInt
(
targetPosition
,
(
int
)
size
);
//this.Dump();
//this.Dump();
return
size
+
5
;
return
size
+
5
;
}
}
...
...
RunTime/DBRuntime/His/Compress/Special/DeadAreaCompressUnit.cs
浏览文件 @
0f720e00
...
@@ -65,7 +65,7 @@ namespace Cdy.Tag
...
@@ -65,7 +65,7 @@ namespace Cdy.Tag
/// <param name="count"></param>
/// <param name="count"></param>
/// <param name="emptyIds"></param>
/// <param name="emptyIds"></param>
/// <returns></returns>
/// <returns></returns>
protected
override
Memory
<
byte
>
CompressValues
<
T
>(
MarshalMemoryBlock
source
,
long
offset
,
int
count
,
Queue
<
int
>
emptyIds
)
protected
override
Memory
<
byte
>
CompressValues
<
T
>(
MarshalMemoryBlock
source
,
long
offset
,
int
count
,
CustomQueue
<
int
>
emptys
,
TagType
type
)
{
{
var
deadArea
=
this
.
Parameters
.
ContainsKey
(
"DeadValue"
)
?
this
.
Parameters
[
"DeadValue"
]
:
0
;
var
deadArea
=
this
.
Parameters
.
ContainsKey
(
"DeadValue"
)
?
this
.
Parameters
[
"DeadValue"
]
:
0
;
var
deadType
=
(
int
)(
this
.
Parameters
.
ContainsKey
(
"DeadType"
)
?
this
.
Parameters
[
"DeadType"
]
:
0
);
var
deadType
=
(
int
)(
this
.
Parameters
.
ContainsKey
(
"DeadType"
)
?
this
.
Parameters
[
"DeadType"
]
:
0
);
...
@@ -76,7 +76,7 @@ namespace Cdy.Tag
...
@@ -76,7 +76,7 @@ namespace Cdy.Tag
bool
isFirst
=
true
;
bool
isFirst
=
true
;
int
ig
=
-
1
;
int
ig
=
-
1
;
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
if
(
typeof
(
T
)
==
typeof
(
byte
))
if
(
typeof
(
T
)
==
typeof
(
byte
))
{
{
...
@@ -103,8 +103,8 @@ namespace Cdy.Tag
...
@@ -103,8 +103,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
...
@@ -134,8 +134,8 @@ namespace Cdy.Tag
...
@@ -134,8 +134,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
...
@@ -165,8 +165,8 @@ namespace Cdy.Tag
...
@@ -165,8 +165,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
...
@@ -196,8 +196,8 @@ namespace Cdy.Tag
...
@@ -196,8 +196,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
...
@@ -227,8 +227,8 @@ namespace Cdy.Tag
...
@@ -227,8 +227,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
}
}
...
@@ -257,8 +257,8 @@ namespace Cdy.Tag
...
@@ -257,8 +257,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
...
@@ -288,8 +288,8 @@ namespace Cdy.Tag
...
@@ -288,8 +288,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
...
@@ -319,8 +319,8 @@ namespace Cdy.Tag
...
@@ -319,8 +319,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
...
@@ -350,8 +350,8 @@ namespace Cdy.Tag
...
@@ -350,8 +350,8 @@ namespace Cdy.Tag
}
}
else
else
{
{
if
(
emptyIds
.
Count
>
0
)
emptyIds
.
TryDequeue
(
out
ig
)
;
ig
=
emptys
.
Index
>=
0
?
emptys
.
Remove
()
:
-
1
;
}
}
}
}
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
return
mMarshalMemory
.
StartMemory
.
AsMemory
<
byte
>(
0
,
(
int
)
mMarshalMemory
.
Position
);
...
...
RunTime/DBRuntime/His/Compress/Special/LosslessCompressUnit.cs
浏览文件 @
0f720e00
此差异已折叠。
点击以展开。
RunTime/DBRuntime/His/Compress/Special/NoneCompressUnit.cs
浏览文件 @
0f720e00
此差异已折叠。
点击以展开。
RunTime/DBRuntime/His/Compress/Special/SlopeCompressUnit.cs
浏览文件 @
0f720e00
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录