performanceMetricで状態監視
先日menuActionとかいじっててサブメニュー山ほど追加して削除がめんどくさくなったので
app.menus.item(“$ID/Main”).submenus.everyItem().remove();
なんてことしちゃいました。ええ、笑うしかありません。気分的には草で画面全体をうめてしまいたいぐらいです。
きっとこの気持ちはやった人にしか分からないでしょうwww
それでもショートカットは使える所がよけいにおかしいですwww
二度としないと思うので記念にスクショも取りました。ついでですのでご覧下さい。
まあ、それは置いておいて、先日規模の大きいドキュメント向けに書いたscriptのパフォーマンスが出なくて困ってしまいました。ヒットカウントチェックしても正常ですし、これといって思い当たるコードも無いのでどうしようかと考え込んでしまいました。
少し調べてみるとJavascriptからIndesignの内部情報にアクセスする手だてがあるじゃないですか。
というわけで、見本です。
alert(‘CPU time : ‘ + app.performanceMetric(1668314484));
上記はIndesignのCPUタイムを表示します。
そんなこんなプロパティが以下のようなもの
AGMXShowTime | 1095191924 = ‘AGMt’ |
Number of attachable events that have been dispatched. | 1095058292 = ‘AECt’ |
Number of attached scripts that have been executed. | 1095975796 = ‘ASCt’ |
BIB Allocations | 1112097345 = ‘BIBA’ |
BIB Allocations peak | 1111576683 = ‘BAPk’ |
BIB cache | 1112097379 = ‘BIBc’ |
BIB cache peak | 1111707755 = ‘BCPk’ |
change manager update call count | 1129137012 = ‘CMCt’ |
change manager update call time | 1129141357 = ‘CMTm’ |
The core allocation count. | 1128361059 = ‘CAlc’ |
The core memory size. | 1129539962 = ‘CSiz’ |
The CPU time. | 1668314484 = ‘cput’ |
The current memory mark. | 1296921195 = ‘MMrk’ |
database file bytes read | 1145197156 = ‘DBRd’ |
database file bytes written | 1145198450 = ‘DBWr’ |
database file page reads | 1145194098 = ‘DBFr’ |
database file read time | 1145197172 = ‘DBRt’ |
database file write time | 1145198452 = ‘DBWt’ |
database instantiate count | 1145194862 = ‘DBIn’ |
database new UID count | 1145197929 = ‘DBUi’ |
Total amount of time spent dispatching attachable events. | 1145394285 = ‘DETm’ |
draw manager draw time | 1145918573 = ‘DMTm’ |
draw manager number of interrupts | 1145915758 = ‘DMIn’ |
drop shadow file read bytes | 1145459298 = ‘DFRb’ |
drop shadow file read time | 1145459316 = ‘DFRt’ |
drop shadow file write bytes | 1145460578 = ‘DFWb’ |
drop shadow file write time | 1145460596 = ‘DFWt’ |
drop shadow memory read bytes | 1146311266 = ‘DSRb’ |
drop shadow memory read time | 1146311284 = ‘DSRt’ |
drop shadow memory write bytes | 1146312546 = ‘DSWb’ |
drop shadow memory write time | 1146312564 = ‘DSWt’ |
galley composition count | 1195590516 = ‘GCCt’ |
galley composition time | 1195594861 = ‘GCTm’ |
The GDI object count. | 1195657582 = ‘GDIn’ |
The handle count. | 1212378740 = ‘HCnt’ |
heap allocations | 1212247148 = ‘HAll’ |
heap allocations peak | 1212239979 = ‘HAPk’ |
image cache allocations | 1231897409 = ‘ImCA’ |
image cache allocations peak | 1229144427 = ‘ICAk’ |
image cache file bytes read | 1231901284 = ‘ImRd’ |
image cache file bytes written | 1231902578 = ‘ImWr’ |
image cache file read time | 1229148772 = ‘ICRd’ |
image cache file write time | 1229150066 = ‘ICWr’ |
instance cache purge count | 1229148259 = ‘ICPc’ |
layout composition count | 1279476596 = ‘LCCt’ |
layout composition time | 1279480941 = ‘LCTm’ |
memory purge count | 1297105780 = ‘MPCt’ |
memory purge time | 1297110125 = ‘MPTm’ |
minisave count | 1297302388 = ‘MSCt’ |
new snapshot time | 1397651284 = ‘SNwT’ |
The number of threads. | 1853122674 = ‘nthr’ |
The overall system CPU. | 1399025781 = ‘Scpu’ |
The overall user CPU. | 1432580213 = ‘Ucpu’ |
PDF allocactions | 1346651713 = ‘PDFA’ |
PDF allocactions peak | 1346650475 = ‘PDAk’ |
process IO bytes read | 1229935204 = ‘IORd’ |
process IO bytes written | 1229936498 = ‘IOWr’ |
The resident memory size. | 1381198202 = ‘RSiz’ |
snapshot count | 1397965684 = ‘SSCt’ |
snapshot read write byte count | 1397905251 = ‘SRWc’ |
snapshot read write time | 1397905268 = ‘SRWt’ |
The virtual memory size. | 1448307066 = ‘VSiz’ |
VXferAlloc | 1448633921 = ‘VXfA’ |
VXferAllocPeak | 1448624491 = ‘VXAk’ |
VXferBytesRead | 1448633938 = ‘VXfR’ |
VXferBytesWritten | 1448633943 = ‘VXfW’ |
VXferFileBytesRead | 1447445106 = ‘VFBr’ |
VXFerFileBytesWritten | 1447445111 = ‘VFBw’ |
VXferReadTime | 1448628852 = ‘VXRt’ |
VXferWriteTime | 1448630132 = ‘VXWt’ |
XMP filter time | 1481461876 = ‘XMPt’ |
やはり山のようにあります。ですから、ちまちま個別に見ていると手間がかかりますので…
var result = “”;
for (a in PerformanceMetricOptions) {
result += a +”\t” + app.performanceMetric(PerformanceMetricOptions[a])+”\n”;
}
$.write(result);
var w = new Window (“dialog”, ‘properties’);
var txbx = w.add (“edittext”, undefined, result, {multiline: true, scrolling: true});
txbx.maximumSize.height = w.maximumSize.height – 200;
txbx.minimumSize.width = 480;
w.add (“button”, undefined, “close”, {name: “ok”});
w.show ();
スクローラブルなUIに書き出すと同時にコンソールにも書き出してみました。
CPU_TIME 3612.385607
NUMBER_OF_THREADS 27
OVERALL_SYSTEM_CPU 1253.389078
OVERALL_USER_CPU 2359.101553
CORE_ALLOCATION_COUNT 0
CORE_MEMORY_SIZE 0
RESIDENT_MEMORY_SIZE 598945792
VIRTUAL_MEMORY_SIZE 2090872832
CURRENT_MEMORY_MARK 0
HANDLE_COUNT 0
GDI_OBJECT_COUNT 0
HEAP_ALLOCATIONS 0
HEAP_ALLOCATIONS_PEAK 0
MEMORY_PURGE_COUNT 2
MEMORY_PURGE_TIME 1049
BIB_ALLOCATIONS -366073031
BIB_ALLOCATIONS_PEAK -514498
BIB_CACHE 5752050
BIB_CACHE_PEAK 8848608
PDF_ALLOCACTIONS 856096
PDF_ALLOCACTIONS_PEAK 0
IMAGE_CACHE_ALLOCATIONS 0
IMAGE_CACHE_ALLOCATIONS_PEAK 65473720
IMAGE_CACHE_FILE_BYTES_READ 0
IMAGE_CACHE_FILE_BYTES_WRITTEN 0
IMAGE_CACHE_FILE_READ_TIME 0
IMAGE_CACHE_FILE_WRITE_TIME 0
VXFERALLOC 0
VXFERALLOCPEAK 65568768
VXFERBYTESREAD 550654832
VXFERBYTESWRITTEN 520595052
VXFERREADTIME 0
VXFERWRITETIME 0
VXFERFILEBYTESREAD 72286208
VXFERFILEBYTESWRITTEN 169967616
PROCESS_IO_BYTES_READ 0
PROCESS_IO_BYTES_WRITTEN 0
AGMXSHOWTIME 0
DATABASE_FILE_BYTES_READ 0
DATABASE_FILE_BYTES_WRITTEN 0
DATABASE_FILE_READ_TIME 0
DATABASE_FILE_WRITE_TIME 0
DROP_SHADOW_MEMORY_READ_TIME 0
DROP_SHADOW_MEMORY_READ_BYTES 0
DROP_SHADOW_MEMORY_WRITE_TIME 0
DROP_SHADOW_MEMORY_WRITE_BYTES 0
DROP_SHADOW_FILE_READ_TIME 0
DROP_SHADOW_FILE_READ_BYTES 0
DROP_SHADOW_FILE_WRITE_TIME 0
DROP_SHADOW_FILE_WRITE_BYTES 0
CHANGE_MANAGER_UPDATE_CALL_COUNT 73430
CHANGE_MANAGER_UPDATE_CALL_TIME 0
SNAPSHOT_COUNT 11212
GALLEY_COMPOSITION_TIME 0
LAYOUT_COMPOSITION_TIME 0
GALLEY_COMPOSITION_COUNT 0
LAYOUT_COMPOSITION_COUNT 93
DRAW_MANAGER_DRAW_TIME 0
DRAW_MANAGER_NUMBER_OF_INTERRUPTS 3
SNAPSHOT_READ_WRITE_TIME 0
NEW_SNAPSHOT_TIME 0
DATABASE_NEW_UID_COUNT 9274
DATABASE_INSTANTIATE_COUNT 16908290
INSTANCE_CACHE_PURGE_COUNT 14905
MINISAVE_COUNT 113
XMP_FILTER_TIME 0
SNAPSHOT_READ_WRITE_BYTE_COUNT 638352
DATABASE_FILE_PAGE_READS 0
ATTACHABLE_EVENT_COUNT 822
ATTACHED_SCRIPTS_COUNT 31
DISPATCH_EVENT_TIME 96242
結局、いろいろやってみてテーブルが大きすぎると言う事でした。あんまり役に立っていないような…