Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
715385ee
Commit
715385ee
authored
11 years ago
by
Richard Linden
Browse files
Options
Downloads
Patches
Plain Diff
BUILDFIX: don't multiple define class statics...use inline static method instead
parent
5b48107d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llcommon/lltrace.h
+10
-0
10 additions, 0 deletions
indra/llcommon/lltrace.h
indra/llcommon/llunit.h
+22
-12
22 additions, 12 deletions
indra/llcommon/llunit.h
indra/newview/llscenemonitor.cpp
+17
-12
17 additions, 12 deletions
indra/newview/llscenemonitor.cpp
with
49 additions
and
24 deletions
indra/llcommon/lltrace.h
+
10
−
0
View file @
715385ee
...
@@ -265,6 +265,8 @@ class TraceType
...
@@ -265,6 +265,8 @@ class TraceType
size_t
getIndex
()
const
{
return
mAccumulatorIndex
;
}
size_t
getIndex
()
const
{
return
mAccumulatorIndex
;
}
virtual
const
char
*
getUnitLabel
()
{
return
""
;
}
const
std
::
string
&
getName
()
const
{
return
mName
;
}
const
std
::
string
&
getName
()
const
{
return
mName
;
}
protected
:
protected
:
...
@@ -662,6 +664,9 @@ class EventStatHandle
...
@@ -662,6 +664,9 @@ class EventStatHandle
EventStatHandle
(
const
char
*
name
,
const
char
*
description
=
NULL
)
EventStatHandle
(
const
char
*
name
,
const
char
*
description
=
NULL
)
:
trace_t
(
name
,
description
)
:
trace_t
(
name
,
description
)
{}
{}
/*virtual*/
const
char
*
getUnitLabel
()
{
return
LLGetUnitLabel
<
T
>::
getUnitLabel
();
}
};
};
template
<
typename
T
,
typename
VALUE_T
>
template
<
typename
T
,
typename
VALUE_T
>
...
@@ -682,6 +687,8 @@ class SampleStatHandle
...
@@ -682,6 +687,8 @@ class SampleStatHandle
SampleStatHandle
(
const
char
*
name
,
const
char
*
description
=
NULL
)
SampleStatHandle
(
const
char
*
name
,
const
char
*
description
=
NULL
)
:
trace_t
(
name
,
description
)
:
trace_t
(
name
,
description
)
{}
{}
/*virtual*/
const
char
*
getUnitLabel
()
{
return
LLGetUnitLabel
<
T
>::
getUnitLabel
();
}
};
};
template
<
typename
T
,
typename
VALUE_T
>
template
<
typename
T
,
typename
VALUE_T
>
...
@@ -703,6 +710,7 @@ class CountStatHandle
...
@@ -703,6 +710,7 @@ class CountStatHandle
:
trace_t
(
name
)
:
trace_t
(
name
)
{}
{}
/*virtual*/
const
char
*
getUnitLabel
()
{
return
LLGetUnitLabel
<
T
>::
getUnitLabel
();
}
};
};
template
<
typename
T
,
typename
VALUE_T
>
template
<
typename
T
,
typename
VALUE_T
>
...
@@ -755,6 +763,8 @@ class MemStatHandle : public TraceType<MemStatAccumulator>
...
@@ -755,6 +763,8 @@ class MemStatHandle : public TraceType<MemStatAccumulator>
MemStatHandle
(
const
char
*
name
)
MemStatHandle
(
const
char
*
name
)
:
trace_t
(
name
)
:
trace_t
(
name
)
{}
{}
/*virtual*/
const
char
*
getUnitLabel
()
{
return
"B"
;
}
};
};
// measures effective memory footprint of specified type
// measures effective memory footprint of specified type
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/llunit.h
+
22
−
12
View file @
715385ee
...
@@ -406,6 +406,22 @@ COMPARISON_OPERATORS(>=)
...
@@ -406,6 +406,22 @@ COMPARISON_OPERATORS(>=)
COMPARISON_OPERATORS
(
==
)
COMPARISON_OPERATORS
(
==
)
COMPARISON_OPERATORS
(
!=
)
COMPARISON_OPERATORS
(
!=
)
template
<
typename
T
>
struct
LLGetUnitLabel
{
static
const
char
*
getUnitLabel
()
{
return
""
;
}
};
template
<
typename
T
,
typename
STORAGE_T
>
struct
LLGetUnitLabel
<
LLUnit
<
T
,
STORAGE_T
>
>
{
static
const
char
*
getUnitLabel
()
{
return
T
::
getUnitLabel
();
}
};
//
// Unit declarations
//
namespace
LLUnits
namespace
LLUnits
{
{
template
<
typename
T
>
template
<
typename
T
>
...
@@ -427,9 +443,8 @@ struct HighestPrecisionType<LLUnit<UNIT_TYPE, STORAGE_TYPE> >
...
@@ -427,9 +443,8 @@ struct HighestPrecisionType<LLUnit<UNIT_TYPE, STORAGE_TYPE> >
struct unit_name \
struct unit_name \
{ \
{ \
typedef base_unit_name base_unit_t; \
typedef base_unit_name base_unit_t; \
static const char*
s
UnitLabel
;
\
static const char*
get
UnitLabel
() { return unit_label; }
\
}; \
}; \
const char* unit_name::sUnitLabel = unit_label; \
template<typename STORAGE_TYPE> \
template<typename STORAGE_TYPE> \
struct ConversionFactor<unit_name, base_unit_name, STORAGE_TYPE> \
struct ConversionFactor<unit_name, base_unit_name, STORAGE_TYPE> \
{ \
{ \
...
@@ -448,8 +463,7 @@ struct ConversionFactor<base_unit_name, unit_name, STORAGE_TYPE> \
...
@@ -448,8 +463,7 @@ struct ConversionFactor<base_unit_name, unit_name, STORAGE_TYPE> \
} \
} \
}
}
struct
Bytes
{
typedef
Bytes
base_unit_t
;
static
const
char
*
sUnitLabel
;};
struct
Bytes
{
typedef
Bytes
base_unit_t
;
static
const
char
*
getUnitLabel
()
{
return
"B"
;
}};
const
char
*
Bytes
::
sUnitLabel
=
"B"
;
LL_DECLARE_DERIVED_UNIT
(
1024
,
Bytes
,
Kilobytes
,
"KiB"
);
LL_DECLARE_DERIVED_UNIT
(
1024
,
Bytes
,
Kilobytes
,
"KiB"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
,
Bytes
,
Megabytes
,
"MiB"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
,
Bytes
,
Megabytes
,
"MiB"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
*
1024
,
Bytes
,
Gigabytes
,
"GiB"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
*
1024
,
Bytes
,
Gigabytes
,
"GiB"
);
...
@@ -458,28 +472,24 @@ LL_DECLARE_DERIVED_UNIT(1024 / 8, Bytes, Kilobits, "Kib");
...
@@ -458,28 +472,24 @@ LL_DECLARE_DERIVED_UNIT(1024 / 8, Bytes, Kilobits, "Kib");
LL_DECLARE_DERIVED_UNIT
(
1024
/
8
,
Bytes
,
Megabits
,
"Mib"
);
LL_DECLARE_DERIVED_UNIT
(
1024
/
8
,
Bytes
,
Megabits
,
"Mib"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
*
1024
/
8
,
Bytes
,
Gigabits
,
"Gib"
);
LL_DECLARE_DERIVED_UNIT
(
1024
*
1024
*
1024
/
8
,
Bytes
,
Gigabits
,
"Gib"
);
struct
Seconds
{
typedef
Seconds
base_unit_t
;
static
const
char
*
sUnitLabel
;
};
struct
Seconds
{
typedef
Seconds
base_unit_t
;
static
const
char
*
getUnitLabel
()
{
return
"s"
;
}
};
const
char
*
Seconds
::
sUnitLabel
=
"s"
;
LL_DECLARE_DERIVED_UNIT
(
60
,
Seconds
,
Minutes
,
"min"
);
LL_DECLARE_DERIVED_UNIT
(
60
,
Seconds
,
Minutes
,
"min"
);
LL_DECLARE_DERIVED_UNIT
(
60
*
60
,
Seconds
,
Hours
,
"h"
);
LL_DECLARE_DERIVED_UNIT
(
60
*
60
,
Seconds
,
Hours
,
"h"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000.0
,
Seconds
,
Milliseconds
,
"ms"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000.0
,
Seconds
,
Milliseconds
,
"ms"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000000.0
,
Seconds
,
Microseconds
,
"
\x09\x3c
s"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000000.0
,
Seconds
,
Microseconds
,
"
\x09\x3c
s"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000000000.0
,
Seconds
,
Nanoseconds
,
"ns"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000000000.0
,
Seconds
,
Nanoseconds
,
"ns"
);
struct
Meters
{
typedef
Meters
base_unit_t
;
static
const
char
*
sUnitLabel
;
};
struct
Meters
{
typedef
Meters
base_unit_t
;
static
const
char
*
getUnitLabel
()
{
return
"m"
;
}
};
const
char
*
Meters
::
sUnitLabel
=
"m"
;
LL_DECLARE_DERIVED_UNIT
(
1000
,
Meters
,
Kilometers
,
"km"
);
LL_DECLARE_DERIVED_UNIT
(
1000
,
Meters
,
Kilometers
,
"km"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
100.0
,
Meters
,
Centimeters
,
"cm"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
100.0
,
Meters
,
Centimeters
,
"cm"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000.0
,
Meters
,
Millimeters
,
"mm"
);
LL_DECLARE_DERIVED_UNIT
(
1.0
/
1000.0
,
Meters
,
Millimeters
,
"mm"
);
struct
Hertz
{
typedef
Hertz
base_unit_t
;
static
const
char
*
sUnitLabel
;
};
struct
Hertz
{
typedef
Hertz
base_unit_t
;
static
const
char
*
getUnitLabel
()
{
return
"Hz"
;
}
};
const
char
*
Hertz
::
sUnitLabel
=
"Hz"
;
LL_DECLARE_DERIVED_UNIT
(
1000
,
Hertz
,
Kilohertz
,
"KHz"
);
LL_DECLARE_DERIVED_UNIT
(
1000
,
Hertz
,
Kilohertz
,
"KHz"
);
LL_DECLARE_DERIVED_UNIT
(
1000
*
1000
,
Hertz
,
Megahertz
,
"MHz"
);
LL_DECLARE_DERIVED_UNIT
(
1000
*
1000
,
Hertz
,
Megahertz
,
"MHz"
);
LL_DECLARE_DERIVED_UNIT
(
1000
*
1000
*
1000
,
Hertz
,
Gigahertz
,
"GHz"
);
LL_DECLARE_DERIVED_UNIT
(
1000
*
1000
*
1000
,
Hertz
,
Gigahertz
,
"GHz"
);
struct
Radians
{
typedef
Radians
base_unit_t
;
static
const
char
*
sUnitLabel
;};
struct
Radians
{
typedef
Radians
base_unit_t
;
static
const
char
*
getUnitLabel
()
{
return
"rad"
;
}
};
const
char
*
Radians
::
sUnitLabel
=
"rad"
;
LL_DECLARE_DERIVED_UNIT
(
DEG_TO_RAD
,
Radians
,
Degrees
,
"deg"
);
LL_DECLARE_DERIVED_UNIT
(
DEG_TO_RAD
,
Radians
,
Degrees
,
"deg"
);
}
// namespace LLUnits
}
// namespace LLUnits
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llscenemonitor.cpp
+
17
−
12
View file @
715385ee
...
@@ -523,12 +523,18 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
...
@@ -523,12 +523,18 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
std
::
ostringstream
row
;
std
::
ostringstream
row
;
row
<<
it
->
getName
();
row
<<
it
->
getName
();
const
char
*
unit_label
=
it
->
getUnitLabel
();
if
(
unit_label
[
0
])
{
row
<<
"("
<<
unit_label
<<
")"
;
}
S32
samples
=
0
;
S32
samples
=
0
;
for
(
S32
i
=
frame_count
-
1
;
i
>=
0
;
--
i
)
for
(
S32
frame
=
0
;
frame
<
frame_count
;
frame
++
)
{
{
samples
+=
scene_load_recording
.
getPrevRecording
(
i
).
getSampleCount
(
*
it
);
samples
+=
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getSampleCount
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
i
).
getSum
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getSum
(
*
it
);
}
}
row
<<
std
::
endl
;
row
<<
std
::
endl
;
...
@@ -550,10 +556,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
...
@@ -550,10 +556,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32
samples
=
0
;
S32
samples
=
0
;
for
(
S32
i
=
frame_count
-
1
;
i
>=
0
;
--
i
)
for
(
S32
frame
=
0
;
frame
<
frame_count
;
frame
++
)
{
{
samples
+=
scene_load_recording
.
getPrevRecording
(
i
).
getSampleCount
(
*
it
);
samples
+=
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getSampleCount
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
i
).
getMean
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getMean
(
*
it
);
}
}
row
<<
std
::
endl
;
row
<<
std
::
endl
;
...
@@ -575,10 +581,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
...
@@ -575,10 +581,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32
samples
=
0
;
S32
samples
=
0
;
for
(
S32
i
=
frame_count
-
1
;
i
>=
0
;
--
i
)
for
(
S32
frame
=
0
;
frame
<
frame_count
;
frame
++
)
{
{
samples
+=
scene_load_recording
.
getPrevRecording
(
i
).
getSampleCount
(
*
it
);
samples
+=
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getSampleCount
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
i
).
getMean
(
*
it
);
row
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getMean
(
*
it
);
}
}
row
<<
std
::
endl
;
row
<<
std
::
endl
;
...
@@ -596,9 +602,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
...
@@ -596,9 +602,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
{
{
os
<<
it
->
getName
();
os
<<
it
->
getName
();
for
(
S32
i
=
frame_count
-
1
;
i
>=
0
;
--
i
)
for
(
S32
frame
=
0
;
frame
<
frame_count
;
frame
++
)
{
{
os
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
i
).
getSum
(
*
it
).
as
<
LLUnits
::
Megabytes
>
(
).
value
();
os
<<
", "
<<
scene_load_recording
.
getPrevRecording
(
frame_count
-
frame
).
getSum
(
*
it
).
value
();
}
}
os
<<
std
::
endl
;
os
<<
std
::
endl
;
...
@@ -606,7 +612,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
...
@@ -606,7 +612,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
os
.
flush
();
os
.
flush
();
os
.
close
();
os
.
close
();
}
}
//-------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment