--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
+
--- /dev/null
+Copyright (C) 2000 - 2013 Samsung Electronics Co., Ltd.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
\ No newline at end of file
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE\r
+ Version 2.1, February 1999\r
+\r
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+[This is the first released version of the Lesser GPL. It also counts\r
+ as the successor of the GNU Library Public License, version 2, hence\r
+ the version number 2.1.]\r
+\r
+ Preamble\r
+\r
+ The licenses for most software are designed to take away your\r
+freedom to share and change it. By contrast, the GNU General Public\r
+Licenses are intended to guarantee your freedom to share and change\r
+free software--to make sure the software is free for all its users.\r
+\r
+ This license, the Lesser General Public License, applies to some\r
+specially designated software packages--typically libraries--of the\r
+Free Software Foundation and other authors who decide to use it. You\r
+can use it too, but we suggest you first think carefully about whether\r
+this license or the ordinary General Public License is the better\r
+strategy to use in any particular case, based on the explanations below.\r
+\r
+ When we speak of free software, we are referring to freedom of use,\r
+not price. Our General Public Licenses are designed to make sure that\r
+you have the freedom to distribute copies of free software (and charge\r
+for this service if you wish); that you receive source code or can get\r
+it if you want it; that you can change the software and use pieces of\r
+it in new free programs; and that you are informed that you can do\r
+these things.\r
+\r
+ To protect your rights, we need to make restrictions that forbid\r
+distributors to deny you these rights or to ask you to surrender these\r
+rights. These restrictions translate to certain responsibilities for\r
+you if you distribute copies of the library or if you modify it.\r
+\r
+ For example, if you distribute copies of the library, whether gratis\r
+or for a fee, you must give the recipients all the rights that we gave\r
+you. You must make sure that they, too, receive or can get the source\r
+code. If you link other code with the library, you must provide\r
+complete object files to the recipients, so that they can relink them\r
+with the library after making changes to the library and recompiling\r
+it. And you must show them these terms so they know their rights.\r
+\r
+ We protect your rights with a two-step method: (1) we copyright the\r
+library, and (2) we offer you this license, which gives you legal\r
+permission to copy, distribute and/or modify the library.\r
+\r
+ To protect each distributor, we want to make it very clear that\r
+there is no warranty for the free library. Also, if the library is\r
+modified by someone else and passed on, the recipients should know\r
+that what they have is not the original version, so that the original\r
+author's reputation will not be affected by problems that might be\r
+introduced by others.\r
+\r
+ Finally, software patents pose a constant threat to the existence of\r
+any free program. We wish to make sure that a company cannot\r
+effectively restrict the users of a free program by obtaining a\r
+restrictive license from a patent holder. Therefore, we insist that\r
+any patent license obtained for a version of the library must be\r
+consistent with the full freedom of use specified in this license.\r
+\r
+ Most GNU software, including some libraries, is covered by the\r
+ordinary GNU General Public License. This license, the GNU Lesser\r
+General Public License, applies to certain designated libraries, and\r
+is quite different from the ordinary General Public License. We use\r
+this license for certain libraries in order to permit linking those\r
+libraries into non-free programs.\r
+\r
+ When a program is linked with a library, whether statically or using\r
+a shared library, the combination of the two is legally speaking a\r
+combined work, a derivative of the original library. The ordinary\r
+General Public License therefore permits such linking only if the\r
+entire combination fits its criteria of freedom. The Lesser General\r
+Public License permits more lax criteria for linking other code with\r
+the library.\r
+\r
+ We call this license the "Lesser" General Public License because it\r
+does Less to protect the user's freedom than the ordinary General\r
+Public License. It also provides other free software developers Less\r
+of an advantage over competing non-free programs. These disadvantages\r
+are the reason we use the ordinary General Public License for many\r
+libraries. However, the Lesser license provides advantages in certain\r
+special circumstances.\r
+\r
+ For example, on rare occasions, there may be a special need to\r
+encourage the widest possible use of a certain library, so that it becomes\r
+a de-facto standard. To achieve this, non-free programs must be\r
+allowed to use the library. A more frequent case is that a free\r
+library does the same job as widely used non-free libraries. In this\r
+case, there is little to gain by limiting the free library to free\r
+software only, so we use the Lesser General Public License.\r
+\r
+ In other cases, permission to use a particular library in non-free\r
+programs enables a greater number of people to use a large body of\r
+free software. For example, permission to use the GNU C Library in\r
+non-free programs enables many more people to use the whole GNU\r
+operating system, as well as its variant, the GNU/Linux operating\r
+system.\r
+\r
+ Although the Lesser General Public License is Less protective of the\r
+users' freedom, it does ensure that the user of a program that is\r
+linked with the Library has the freedom and the wherewithal to run\r
+that program using a modified version of the Library.\r
+\r
+ The precise terms and conditions for copying, distribution and\r
+modification follow. Pay close attention to the difference between a\r
+"work based on the library" and a "work that uses the library". The\r
+former contains code derived from the library, whereas the latter must\r
+be combined with the library in order to run.\r
+\r
+ GNU LESSER GENERAL PUBLIC LICENSE\r
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+ 0. This License Agreement applies to any software library or other\r
+program which contains a notice placed by the copyright holder or\r
+other authorized party saying it may be distributed under the terms of\r
+this Lesser General Public License (also called "this License").\r
+Each licensee is addressed as "you".\r
+\r
+ A "library" means a collection of software functions and/or data\r
+prepared so as to be conveniently linked with application programs\r
+(which use some of those functions and data) to form executables.\r
+\r
+ The "Library", below, refers to any such software library or work\r
+which has been distributed under these terms. A "work based on the\r
+Library" means either the Library or any derivative work under\r
+copyright law: that is to say, a work containing the Library or a\r
+portion of it, either verbatim or with modifications and/or translated\r
+straightforwardly into another language. (Hereinafter, translation is\r
+included without limitation in the term "modification".)\r
+\r
+ "Source code" for a work means the preferred form of the work for\r
+making modifications to it. For a library, complete source code means\r
+all the source code for all modules it contains, plus any associated\r
+interface definition files, plus the scripts used to control compilation\r
+and installation of the library.\r
+\r
+ Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope. The act of\r
+running a program using the Library is not restricted, and output from\r
+such a program is covered only if its contents constitute a work based\r
+on the Library (independent of the use of the Library in a tool for\r
+writing it). Whether that is true depends on what the Library does\r
+and what the program that uses the Library does.\r
+ \r
+ 1. You may copy and distribute verbatim copies of the Library's\r
+complete source code as you receive it, in any medium, provided that\r
+you conspicuously and appropriately publish on each copy an\r
+appropriate copyright notice and disclaimer of warranty; keep intact\r
+all the notices that refer to this License and to the absence of any\r
+warranty; and distribute a copy of this License along with the\r
+Library.\r
+\r
+ You may charge a fee for the physical act of transferring a copy,\r
+and you may at your option offer warranty protection in exchange for a\r
+fee.\r
+\r
+ 2. You may modify your copy or copies of the Library or any portion\r
+of it, thus forming a work based on the Library, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+ a) The modified work must itself be a software library.\r
+\r
+ b) You must cause the files modified to carry prominent notices\r
+ stating that you changed the files and the date of any change.\r
+\r
+ c) You must cause the whole of the work to be licensed at no\r
+ charge to all third parties under the terms of this License.\r
+\r
+ d) If a facility in the modified Library refers to a function or a\r
+ table of data to be supplied by an application program that uses\r
+ the facility, other than as an argument passed when the facility\r
+ is invoked, then you must make a good faith effort to ensure that,\r
+ in the event an application does not supply such function or\r
+ table, the facility still operates, and performs whatever part of\r
+ its purpose remains meaningful.\r
+\r
+ (For example, a function in a library to compute square roots has\r
+ a purpose that is entirely well-defined independent of the\r
+ application. Therefore, Subsection 2d requires that any\r
+ application-supplied function or table used by this function must\r
+ be optional: if the application does not supply it, the square\r
+ root function must still compute square roots.)\r
+\r
+These requirements apply to the modified work as a whole. If\r
+identifiable sections of that work are not derived from the Library,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works. But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Library, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote\r
+it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Library.\r
+\r
+In addition, mere aggregation of another work not based on the Library\r
+with the Library (or with a work based on the Library) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+ 3. You may opt to apply the terms of the ordinary GNU General Public\r
+License instead of this License to a given copy of the Library. To do\r
+this, you must alter all the notices that refer to this License, so\r
+that they refer to the ordinary GNU General Public License, version 2,\r
+instead of to this License. (If a newer version than version 2 of the\r
+ordinary GNU General Public License has appeared, then you can specify\r
+that version instead if you wish.) Do not make any other change in\r
+these notices.\r
+\r
+ Once this change is made in a given copy, it is irreversible for\r
+that copy, so the ordinary GNU General Public License applies to all\r
+subsequent copies and derivative works made from that copy.\r
+\r
+ This option is useful when you wish to copy part of the code of\r
+the Library into a program that is not a library.\r
+\r
+ 4. You may copy and distribute the Library (or a portion or\r
+derivative of it, under Section 2) in object code or executable form\r
+under the terms of Sections 1 and 2 above provided that you accompany\r
+it with the complete corresponding machine-readable source code, which\r
+must be distributed under the terms of Sections 1 and 2 above on a\r
+medium customarily used for software interchange.\r
+\r
+ If distribution of object code is made by offering access to copy\r
+from a designated place, then offering equivalent access to copy the\r
+source code from the same place satisfies the requirement to\r
+distribute the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+ 5. A program that contains no derivative of any portion of the\r
+Library, but is designed to work with the Library by being compiled or\r
+linked with it, is called a "work that uses the Library". Such a\r
+work, in isolation, is not a derivative work of the Library, and\r
+therefore falls outside the scope of this License.\r
+\r
+ However, linking a "work that uses the Library" with the Library\r
+creates an executable that is a derivative of the Library (because it\r
+contains portions of the Library), rather than a "work that uses the\r
+library". The executable is therefore covered by this License.\r
+Section 6 states terms for distribution of such executables.\r
+\r
+ When a "work that uses the Library" uses material from a header file\r
+that is part of the Library, the object code for the work may be a\r
+derivative work of the Library even though the source code is not.\r
+Whether this is true is especially significant if the work can be\r
+linked without the Library, or if the work is itself a library. The\r
+threshold for this to be true is not precisely defined by law.\r
+\r
+ If such an object file uses only numerical parameters, data\r
+structure layouts and accessors, and small macros and small inline\r
+functions (ten lines or less in length), then the use of the object\r
+file is unrestricted, regardless of whether it is legally a derivative\r
+work. (Executables containing this object code plus portions of the\r
+Library will still fall under Section 6.)\r
+\r
+ Otherwise, if the work is a derivative of the Library, you may\r
+distribute the object code for the work under the terms of Section 6.\r
+Any executables containing that work also fall under Section 6,\r
+whether or not they are linked directly with the Library itself.\r
+\r
+ 6. As an exception to the Sections above, you may also combine or\r
+link a "work that uses the Library" with the Library to produce a\r
+work containing portions of the Library, and distribute that work\r
+under terms of your choice, provided that the terms permit\r
+modification of the work for the customer's own use and reverse\r
+engineering for debugging such modifications.\r
+\r
+ You must give prominent notice with each copy of the work that the\r
+Library is used in it and that the Library and its use are covered by\r
+this License. You must supply a copy of this License. If the work\r
+during execution displays copyright notices, you must include the\r
+copyright notice for the Library among them, as well as a reference\r
+directing the user to the copy of this License. Also, you must do one\r
+of these things:\r
+\r
+ a) Accompany the work with the complete corresponding\r
+ machine-readable source code for the Library including whatever\r
+ changes were used in the work (which must be distributed under\r
+ Sections 1 and 2 above); and, if the work is an executable linked\r
+ with the Library, with the complete machine-readable "work that\r
+ uses the Library", as object code and/or source code, so that the\r
+ user can modify the Library and then relink to produce a modified\r
+ executable containing the modified Library. (It is understood\r
+ that the user who changes the contents of definitions files in the\r
+ Library will not necessarily be able to recompile the application\r
+ to use the modified definitions.)\r
+\r
+ b) Use a suitable shared library mechanism for linking with the\r
+ Library. A suitable mechanism is one that (1) uses at run time a\r
+ copy of the library already present on the user's computer system,\r
+ rather than copying library functions into the executable, and (2)\r
+ will operate properly with a modified version of the library, if\r
+ the user installs one, as long as the modified version is\r
+ interface-compatible with the version that the work was made with.\r
+\r
+ c) Accompany the work with a written offer, valid for at\r
+ least three years, to give the same user the materials\r
+ specified in Subsection 6a, above, for a charge no more\r
+ than the cost of performing this distribution.\r
+\r
+ d) If distribution of the work is made by offering access to copy\r
+ from a designated place, offer equivalent access to copy the above\r
+ specified materials from the same place.\r
+\r
+ e) Verify that the user has already received a copy of these\r
+ materials or that you have already sent this user a copy.\r
+\r
+ For an executable, the required form of the "work that uses the\r
+Library" must include any data and utility programs needed for\r
+reproducing the executable from it. However, as a special exception,\r
+the materials to be distributed need not include anything that is\r
+normally distributed (in either source or binary form) with the major\r
+components (compiler, kernel, and so on) of the operating system on\r
+which the executable runs, unless that component itself accompanies\r
+the executable.\r
+\r
+ It may happen that this requirement contradicts the license\r
+restrictions of other proprietary libraries that do not normally\r
+accompany the operating system. Such a contradiction means you cannot\r
+use both them and the Library together in an executable that you\r
+distribute.\r
+\r
+ 7. You may place library facilities that are a work based on the\r
+Library side-by-side in a single library together with other library\r
+facilities not covered by this License, and distribute such a combined\r
+library, provided that the separate distribution of the work based on\r
+the Library and of the other library facilities is otherwise\r
+permitted, and provided that you do these two things:\r
+\r
+ a) Accompany the combined library with a copy of the same work\r
+ based on the Library, uncombined with any other library\r
+ facilities. This must be distributed under the terms of the\r
+ Sections above.\r
+\r
+ b) Give prominent notice with the combined library of the fact\r
+ that part of it is a work based on the Library, and explaining\r
+ where to find the accompanying uncombined form of the same work.\r
+\r
+ 8. You may not copy, modify, sublicense, link with, or distribute\r
+the Library except as expressly provided under this License. Any\r
+attempt otherwise to copy, modify, sublicense, link with, or\r
+distribute the Library is void, and will automatically terminate your\r
+rights under this License. However, parties who have received copies,\r
+or rights, from you under this License will not have their licenses\r
+terminated so long as such parties remain in full compliance.\r
+\r
+ 9. You are not required to accept this License, since you have not\r
+signed it. However, nothing else grants you permission to modify or\r
+distribute the Library or its derivative works. These actions are\r
+prohibited by law if you do not accept this License. Therefore, by\r
+modifying or distributing the Library (or any work based on the\r
+Library), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Library or works based on it.\r
+\r
+ 10. Each time you redistribute the Library (or any work based on the\r
+Library), the recipient automatically receives a license from the\r
+original licensor to copy, distribute, link with or modify the Library\r
+subject to these terms and conditions. You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties with\r
+this License.\r
+\r
+ 11. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License. If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Library at all. For example, if a patent\r
+license would not permit royalty-free redistribution of the Library by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Library.\r
+\r
+If any portion of this section is held invalid or unenforceable under any\r
+particular circumstance, the balance of the section is intended to apply,\r
+and the section as a whole is intended to apply in other circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system which is\r
+implemented by public license practices. Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+ 12. If the distribution and/or use of the Library is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Library under this License may add\r
+an explicit geographical distribution limitation excluding those countries,\r
+so that distribution is permitted only in or among countries not thus\r
+excluded. In such case, this License incorporates the limitation as if\r
+written in the body of this License.\r
+\r
+ 13. The Free Software Foundation may publish revised and/or new\r
+versions of the Lesser General Public License from time to time.\r
+Such new versions will be similar in spirit to the present version,\r
+but may differ in detail to address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number. If the Library\r
+specifies a version number of this License which applies to it and\r
+"any later version", you have the option of following the terms and\r
+conditions either of that version or of any later version published by\r
+the Free Software Foundation. If the Library does not specify a\r
+license version number, you may choose any version ever published by\r
+the Free Software Foundation.\r
+\r
+ 14. If you wish to incorporate parts of the Library into other free\r
+programs whose distribution conditions are incompatible with these,\r
+write to the author to ask for permission. For software which is\r
+copyrighted by the Free Software Foundation, write to the Free\r
+Software Foundation; we sometimes make exceptions for this. Our\r
+decision will be guided by the two goals of preserving the free status\r
+of all derivatives of our free software and of promoting the sharing\r
+and reuse of software generally.\r
+\r
+ NO WARRANTY\r
+\r
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
+DAMAGES.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ How to Apply These Terms to Your New Libraries\r
+\r
+ If you develop a new library, and you want it to be of the greatest\r
+possible use to the public, we recommend making it free software that\r
+everyone can redistribute and change. You can do so by permitting\r
+redistribution under these terms (or, alternatively, under the terms of the\r
+ordinary General Public License).\r
+\r
+ To apply these terms, attach the following notices to the library. It is\r
+safest to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least the\r
+"copyright" line and a pointer to where the full notice is found.\r
+\r
+ <one line to give the library's name and a brief idea of what it does.>\r
+ Copyright (C) <year> <name of author>\r
+\r
+ This library is free software; you can redistribute it and/or\r
+ modify it under the terms of the GNU Lesser General Public\r
+ License as published by the Free Software Foundation; either\r
+ version 2 of the License, or (at your option) any later version.\r
+\r
+ This library is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public\r
+ License along with this library; if not, write to the Free Software\r
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the library, if\r
+necessary. Here is a sample; alter the names:\r
+\r
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
+\r
+ <signature of Ty Coon>, 1 April 1990\r
+ Ty Coon, President of Vice\r
+\r
+That's all there is to it!\r
+\r
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+
+jcommon.jar file is licensed under Lesser General Public License Version 2.1
+Please, see LICENSE.LGPLv2.1 file for Lesser General Public License terms and conditions.
+
+org.eclipse.cdt.core.jar, org.eclipse.cdt.debug.edc.jar, org.eclipse.cdt.dsf.jar and org.eclipse.nebula.widgets.grid.jar files are licensed under Eclipse Public License Version 1.0.
+Please, see LICENSE.EPL file for Eclipse Public License terms and conditions.
+
+sqlitejdbc.jar file is licensed under Berkeley Software Distribution.
+Please, see LICENSE.BSD2c file for Berkeley Software Distribution terms and conditions.
private List<Image> imageList = null;
Timer timer = null;
- long startTime = 0;
+// long startTime = 0;
long interval = 100;
int index = 0;
stopTimer();
}
- startTime = System.currentTimeMillis();
+// startTime = System.currentTimeMillis();
timer = new Timer();
timer.schedule(new TimerTask() {
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
*/
private void setDefaultColors() {
attr.setColor(STATE_DISABLE,
- new Color(Display.getCurrent(), 48, 48, 48));
- attr.setColor(STATE_PUSH, new Color(Display.getCurrent(), 29, 109, 140));
- attr.setColor(STATE_HOVER, new Color(Display.getCurrent(), 0, 134, 185));
- attr.setColor(STATE_NORMAL, new Color(Display.getCurrent(), 67, 67, 67));
+ ColorResources.BUTTON_STATE_DISABLE);
+ attr.setColor(STATE_PUSH, ColorResources.BUTTON_STATE_PUSH);
+ attr.setColor(STATE_HOVER, ColorResources.BUTTON_STATE_HOVER);
+ attr.setColor(STATE_NORMAL, ColorResources.BUTTON_STATE_NORMAL);
}
protected PaintListener buttonPaintListener = new PaintListener() {
import org.eclipse.swt.graphics.Point;
public class DACustomButtonAttribute {
- private final int MAX_SIZE = 12;
+ private static final int MAX_SIZE = 12;
private String text;
private Image buttonImage = null;
private Font font;
}\r
}\r
\r
- private Listener toggleButtonMouseListener = new Listener() {\r
+ protected Listener toggleButtonMouseListener = new Listener() {\r
\r
@Override\r
public void handleEvent(Event event) {\r
public void clear() {
seriesList.clear();
plot.clear();
+ chartBuffer.dispose();
}
public void contentsClear() {
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
public class DAChartPlotTooltip {
public Color getBackgroundColor() {
if (null == backgroundColor) {
- backgroundColor = new Color(Display.getCurrent(), 204, 228, 247);
+ backgroundColor = ColorResources.CHART_TOOLTIP_BACKGROUND;
}
return backgroundColor;
}
public Color getForegroundColor() {
if (null == foregroundColor) {
- foregroundColor = new Color(Display.getCurrent(), 240, 249, 255);
+ foregroundColor = ColorResources.CHART_TOOLTIP_FOREGROUND;
}
return foregroundColor;
}
public Color getLineColor() {
if (null == lineColor) {
- lineColor = new Color(Display.getCurrent(), 0, 0, 0);
+ lineColor = ColorResources.CHART_TOOLTIP_LINE;
}
return lineColor;
}
public Color getTextColor() {
if (null == textColor) {
- textColor = new Color(Display.getCurrent(), 50, 50, 50);
+ textColor = ColorResources.CHART_TOOLTIP_TEXT;
}
return textColor;
}
public Color getTimeColor() {
if (null == timeColor) {
- timeColor = new Color(Display.getCurrent(), 120, 147, 185);
+ timeColor = ColorResources.CHART_TOOLTIP_TIME;
}
return timeColor;
}
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
public class DAChartRenderer {
- private final int MARGIN = 3;
- private final int ARROW_MARGIN = 2;
- private final int EVENT_WIDTH = 2;
- private final double EVENT_HEIGHT_MARGIN_RATIO = 0.20;
- private final double LOAD_HEIGHT_MARGIN_RATIO = 0.20;
+ private static final int MARGIN = 3;
+ private static final int ARROW_MARGIN = 2;
+ private static final int EVENT_WIDTH = 2;
+ private static final double EVENT_HEIGHT_MARGIN_RATIO = 0.20;
+ private static final double LOAD_HEIGHT_MARGIN_RATIO = 0.20;
private boolean bInitialized = false;
private List<DAChartSeries> seriesList = null;
private DAChartPlot plot = null;
private Rectangle r = null;
- private final int SCREENSHOT_Y_POSITION_MINI = 4;
- private final int SCREENSHOT_SELECTED_Y_POSITION = 4;
- private final int SCREENSHOT_SELECTED_Y_POSITION_MINI = 1;
- private final int SCREENSHOT_SELECTED_LINE_WIDTH = 2;
- private final int SCREENSHOT_BORDER_LINE_WIDTH = 1;
+ private static final int SCREENSHOT_Y_POSITION_MINI = 4;
+ private static final int SCREENSHOT_SELECTED_Y_POSITION = 4;
+ private static final int SCREENSHOT_SELECTED_Y_POSITION_MINI = 1;
+ private static final int SCREENSHOT_SELECTED_LINE_WIDTH = 2;
+ private static final int SCREENSHOT_BORDER_LINE_WIDTH = 1;
- private final int MULTY_CHECK_BAR_WIDTH = 2;
+ private static final int MULTY_CHECK_BAR_WIDTH = 2;
- private final int AXIS_LINE_WIDTH = 4;
- private final int AXIS_MARGIN = 2;
+ private static final int AXIS_LINE_WIDTH = 4;
+ private static final int AXIS_MARGIN = 2;
public void draw(GC gc, DAChart chart, Image buffer) {
if (false == bInitialized) {
if (null != axisUnit) {
text += axisUnit;
}
- textHeight = gc.textExtent(text).y;
+
if (true == bPosRight) {
textX = x1 - gc.textExtent(text).x - AXIS_MARGIN - AXIS_LINE_WIDTH;
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
public class DAChartTooltip {
private static DAChartTooltip instance = null;
shell.setLayout(new FillLayout());
contents = new Canvas(shell, SWT.NONE);
- contents.setBackground(new Color(Display.getCurrent(), 193, 193,
- 193));
+ contents.setBackground(ColorResources.CHART_TOOLTIP_BACKGROUND_BACKGROUND);
contents.addPaintListener(new PaintListener() {
init(parent);
Point pt = Display.getCurrent().getCursorLocation();
-
+
shell.setBounds(pt.x + 10, pt.y - tooltipInfo.height - 10,
tooltipInfo.width, tooltipInfo.height);
shell.open();
if (null == shell || null == tooltipInfo) {
return;
}
- DAChartPlotTooltip tooltip = tooltipInfo.chart.getPlot()
- .getTooltip();
+ DAChartPlotTooltip tooltip = tooltipInfo.chart.getPlot().getTooltip();
if (tooltipInfo.xVal != tooltip.getStartVal()) {
makeTooltipInfo(tooltipInfo.chart);
+ (DAChartPlotTooltip.TOOLTIP_MARGIN * 2);
tooltipInfo.xVal = tooltip.getStartVal();
- GC tempGC = new GC(new Image(Display.getCurrent(), MAX_WIDTH,
- MAX_HEIGHT));
+ Image image = new Image(Display.getCurrent(), MAX_WIDTH, MAX_HEIGHT);
+ GC tempGC = new GC(image);
tempGC.setFont(tooltip.getFont());
for (int i = 0; i < seriesList.size(); i++) {
}
tooltipInfo.width += DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ (DAChartPlotTooltip.TOOLTIP_MARGIN * 3);
+ tempGC.dispose();
+ image.dispose();
return true;
}
private void drawTooltip(GC gc) {
- DAChartPlotTooltip tooltip = tooltipInfo.chart.getPlot()
- .getTooltip();
- List<DAChartSeries> seriesList = tooltipInfo.chart
- .getSeriesList();
+ DAChartPlotTooltip tooltip = tooltipInfo.chart.getPlot().getTooltip();
+ List<DAChartSeries> seriesList = tooltipInfo.chart.getSeriesList();
if (null == tooltip || false == tooltip.isTooltip()
|| -1 == tooltip.getStartVal()) {
DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH);
gc.setBackground(tooltip.getBackgroundColor());
- gc.drawText(
- tooltipInfo.tooltipTexts.get(i),
+ gc.drawText(tooltipInfo.tooltipTexts.get(i),
DAChartPlotTooltip.TOOLTIP_MARGIN
+ DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ DAChartPlotTooltip.TOOLTIP_MARGIN, y
if (null == item) {
return;
}
- oldImage = selectItem.getChart().getPlot().getBackgroundImage();
+ DAChart chart = selectItem.getChart();
+ if(null == chart){
+ return;
+ }
+ oldImage = chart.getPlot().getBackgroundImage();
setChartBackgroundImage(selectItem.getChart(),
ImageResources.CHART_BG_SELECT);
selectItem.selectItem(true);
return;
}
DAChartBoardItem item = itemList.get(parentIndex);
+
+ if(null == item){
+ return;
+ }
DAChartBoardItemList childList = item.getChildChartComposite();
public void clear() {
if (null != childList) {
childList.clear();
+ childList.dispose();
}
- itemCell.getChartCell().clear();
-
+ itemCell.clear();
+ itemCell.dispose();
}
public void contentsClear() {
childList.contentsClear();
}
- itemCell.getChartCell().contentsClear();
+ itemCell.contentsClear();
}
childFoldButton.redraw();
bufGc.dispose();
}
+
+ public void clear() {
+ if(null != foldBackBuffer){
+ foldBackBuffer.dispose();
+ foldBackBuffer = null;
+ }
+ if(null != chartCell){
+ chartCell.clear();
+ chartCell.dispose();
+ }
+ if(null != nameCell){
+ nameCell.dispose();
+ }
+ }
+ public void contentsClear() {
+ if(null != chartCell){
+ chartCell.contentsClear();
+ }
+ }
}
}
int itemsSize = items.size();
for (int i = 0; i < itemsSize; i++) {
+ items.get(i).clear();
items.get(i).dispose();
}
items.clear();
private int itemIndex = 0;
private boolean dirty = false;
private Timer closeTimer = null;
- private final int CLOSE_WAITING_TIME = 500;
+ private static final int CLOSE_WAITING_TIME = 500;
private List<String> items;
private List<Rectangle> rects = null;
public static final int STATE_HOVER = 2;
public static final int STATE_DISABLE = 3;
- private final int DEFAULT_HEIGHT = 24;
- private final int CHARACTER_WIDTH_PIXEL = 8;
- private final int STORKE_PIXEL = 2;
- private final int STAUES_ITEMS_CHECK_TIME = 500;
- private final int ADJUSTED_CONTEXT_MENU_POINT = 5;
+ private static final int DEFAULT_HEIGHT = 24;
+ private static final int CHARACTER_WIDTH_PIXEL = 8;
+ private static final int STORKE_PIXEL = 2;
+ private static final int STAUES_ITEMS_CHECK_TIME = 500;
+ private static final int ADJUSTED_CONTEXT_MENU_POINT = 5;
private int menuShellWidth = 25;
private int titleHeight = 0;
if (null == display) {
display = Display.getDefault();
}
- Point pt = Display.getCurrent().getCursorLocation();
+ Point pt = display.getCursorLocation();
return pt;
}
*/
public void open() {
Point pt = computeContextMenuLocation();
- pt.x = pt.x -= ADJUSTED_CONTEXT_MENU_POINT;
- pt.y = pt.y -= ADJUSTED_CONTEXT_MENU_POINT;
+ pt.x = pt.x - ADJUSTED_CONTEXT_MENU_POINT;
+ pt.y = pt.y - ADJUSTED_CONTEXT_MENU_POINT;
open(pt.x, pt.y);
}
private String measure = Formatter.toByteFormatMeasure(0);
private String labelText = DAWidgetConstants.EMPTY_STRING;
- private final int INNER_MARGIN = 3;
- private final int LABEL_MARGIN = 15;
+ private static final int INNER_MARGIN = 3;
+ private static final int LABEL_MARGIN = 15;
private int graphCount = 4;
private int graphWidth = 16;
private int graphType = TYPE_PERCENT;
public static int TYPE_PERCENT = 0;
public static int TYPE_BYTE = 1;
- private final int TOP_MARGIN = 5;
- private final int BOTTOM_MARGIN = 4;
- private final int BOTTOM_FULL_MARGIN = 15;
+ private static final int TOP_MARGIN = 5;
+ private static final int BOTTOM_MARGIN = 4;
+ private static final int BOTTOM_FULL_MARGIN = 15;
private int graphType = TYPE_PERCENT;
public class CircularGraph extends Composite {
- private final int DEFAULT_ANGLE = 90;
+ private static final int DEFAULT_ANGLE = 90;
public static final int TYPE_PERCENT = 0;
public static final int TYPE_CUSTOM = 1;
private int type = TYPE_PERCENT;
private Color textColor = ColorResources.ITEM_BLUE_BRIGHT;
- private final int DEFAULT_WIDTH = 74;
- private final int DEFAULT_HEIGHT = 74;
+ private static final int DEFAULT_WIDTH = 74;
+ private static final int DEFAULT_HEIGHT = 74;
public CircularGraph(Composite parent, int style, int type) {
super(parent, style);
\r
public static Color CHART_AXIS = getColor(\r
"chart_axis", new RGB(94, 144, 160)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_BACKGROUND_BACKGROUND = getColor(\r
+ "chart_tooltip_background_background", new RGB(193, 193,\r
+ 193)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_BACKGROUND = getColor(\r
+ "chart_tooltip_background", new RGB(204, 228, 247)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_FOREGROUND = getColor(\r
+ "chart_tooltip_foreground", new RGB(240, 249, 255)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_LINE = getColor(\r
+ "chart_tooltip_line", new RGB(0, 0, 0)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_TEXT = getColor(\r
+ "chart_tooltip_text", new RGB(50, 50, 50)); //$NON-NLS-1$\r
+ \r
+ public static Color CHART_TOOLTIP_TIME = getColor(\r
+ "chart_tooltip_time", new RGB(120, 147, 185)); //$NON-NLS-1$\r
+ \r
+ //Button\r
+ public static Color BUTTON_STATE_DISABLE = getColor(\r
+ "button_state_disable", new RGB(48, 48, 48)); //$NON-NLS-1$\r
+ \r
+ public static Color BUTTON_STATE_PUSH = getColor(\r
+ "button_state_push", new RGB(29, 109, 140)); //$NON-NLS-1$\r
+ \r
+ public static Color BUTTON_STATE_HOVER = getColor(\r
+ "button_state_hover", new RGB(0, 134, 185)); //$NON-NLS-1$\r
+ \r
+ public static Color BUTTON_STATE_NORMAL = getColor(\r
+ "button_state_normal", new RGB(67, 67, 67)); //$NON-NLS-1$\r
\r
// shell window background color\r
public static final Color WINDOW_BG_COLOR = getColor(\r
}
else{
remainder /= 100;
- remainder = Math.round(remainder);
+ remainder = Math.round((float)remainder);
ret = String.format("%d.%d%s", quotient,remainder,unit);
}
return ret;
}
else{
remainder /= 100;
- remainder = Math.round(remainder);
+ remainder = Math.round((float)remainder);
ret = String.format("%d.%d%s", quotient,remainder,unit);
ret = String.format("%d.%d%s", quotient,remainder,unit);
}
public Progress(Composite parent, int style, int progressStyle) {
this(parent, style);
- style = progressStyle;
+ this.style = progressStyle;
}
public int getValue() {
public class TimerClock extends Canvas {
- private class TimeString {
+ private static class TimeString {
public String hour;
public String hour2;
public String min;
version="0.0.0"
unpack="false"/>
+<plugin
+ id="org.tizen.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ui.ide"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ui.console"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jface.text"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.resources"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.filesystem"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ant.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.compare.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.core.variables"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.p2.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.p2.engine"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.p2.metadata"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.p2.metadata.repository"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.p2.repository"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.equinox.security"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.text"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ui.forms"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ui.views"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.ui.workbench.texteditor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.junit"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.junit4"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.hamcrest.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
</checks>
<checks>
+ <name>new</name>
+ <type>0</type>
+ <category>1</category>
+ <keyIndex>14</keyIndex>
+ <checkUserCall>true</checkUserCall>
+ </checks>
+
+ <checks>
<name>app_get_name</name>
<type>0</type>
<category>1</category>
</checks>
<checks>
+ <name>delete</name>
+ <type>1</type>
+ <category>1</category>
+ <keyIndex>14</keyIndex>
+ <checkUserCall>true</checkUserCall>
+ </checks>
+
+ <checks>
<name>open</name>
<type>0</type>
<category>5</category>
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
import java.util.Locale;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.ui.PlatformUI;
public class Application implements IApplication {
- private final boolean STDOUT_TO_FILE = false;
+ private boolean STDOUT_TO_FILE = false;
+ private static final String LOG_PREFIX = "da_log_";
+ private static final int LOG_COUNT = 3;
@Override
public Object start(IApplicationContext context) throws Exception {
Locale.KOREA);
Date date = new Date();
String logPostFix = format.format(date);
- WorkbenchPathManager.setLogPostFix(logPostFix);
+ WorkbenchUtils.setLogPostFix(logPostFix);
if (STDOUT_TO_FILE) {
- String logPath = WorkbenchPathManager.getLogsPath();
+ String logPath = WorkbenchUtils.getLogsPath();
File logs = new File(logPath);
if (!logs.exists()) {
logs.mkdirs();
}
- String logFileName = "da_log_" + logPostFix;//$NON-NLS-1$
+ String logFileName = LOG_PREFIX + logPostFix;//$NON-NLS-1$
logPath += File.separator + logFileName;
File file = new File(logPath);
PrintStream ps = new PrintStream(fos);
System.setOut(ps);
System.setErr(ps);
+
+ checkLogs(logs.getPath());
}
String[] argv = (String[]) context.getArguments().get(
} else {
ApplicationWorkbenchWindowAdvisor.setAutoStart(false);
}
-
+
int returnCode = PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
}
});
}
+
+ private void checkLogs(String path) {
+ List<String> logFiles = WorkbenchUtils.getFiles(path);
+
+ List<String> daLogFiles = new ArrayList<String>();
+ for (String name : logFiles) {
+ if (name.contains(LOG_PREFIX)) {
+ daLogFiles.add(name);
+ }
+ }
+
+ if (daLogFiles.size() > 3) {
+ Collections.sort(daLogFiles);
+ int to = daLogFiles.size() - LOG_COUNT;
+ for (int i = 0; i < to; i++) {
+ File deleteFile = new File(path + File.separator
+ + daLogFiles.get(i));
+ if (null != deleteFile) {
+ WorkbenchUtils.deleteFile(deleteFile);
+ }
+ }
+ }
+ }
}
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.ExitHandler;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogValues;
WelcomeDialog dialog = new WelcomeDialog(shell, SWT.NONE); // FIXME
dialog.open();
}
- PathManager.setLogPostFix(WorkbenchPathManager.getLogPostFix());
+ PathManager.setLogPostFix(WorkbenchUtils.getLogPostFix());
}
public boolean preWindowShellClose() {
if (DACommunicator.isRunning()) {
- DACommunicator.sendStopMessage();
+// DACommunicator.sendStopMessage();
+ DACommunicator.stopTrace();
}
AnalyzerUtil.executeCommand(ExitHandler.ID);
- ToolbarArea.getInstance().dispose();
+ if (null != ToolbarArea.getInstance()) {
+ ToolbarArea.getInstance().dispose();
+ }
return true;
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.workbench;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WorkbenchUtils {
+
+ public static final String WIN_INSTALL_NODE = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";//$NON-NLS-1$
+ public static final String WIN_INSTALL_KEY = "Local AppData"; //$NON-NLS-1$
+
+ public static final String LINUX_INSTALL_ENV = "HOME";//$NON-NLS-1$
+ public static final String TIZEN_SDK_DATA = "tizen-sdk-data";//$NON-NLS-1$
+ public static final String TIZEN_SDK_DATA_PATH = getTizenSdkDataPath();
+ public static final String INSTALL = "tizensdkpath"; //$NON-NLS-1$
+ public static final String TIZEN_ROOT_PATH = getDefaultRoot();
+ public static final String TOOLS_FOLDER_NAME = "tools"; //$NON-NLS-1$
+ public static final String DYNAMIC_ANALYZER_FOLDER_NAME = "dynamic-analyzer"; //$NON-NLS-1$
+ public static final String SAVE_FOLDER_NAME = "save"; //$NON-NLS-1$
+ public static final String LOG_FOLDER_NAME = "logs"; //$NON-NLS-1$
+ public static final String DYNAMIC_ANALYZER_INSTALL_PATH = getInstallPath();
+ public static final String CONFIG_FOLDER_NAME = "config"; //$NON-NLS-1$
+ public static final String CONFIG_FOLDER_PATH = getConfigFolderPath();
+ public static final String CONFIG_FILE_NAME = "config"; //$NON-NLS-1$
+
+ public static final String OS_KEY = "os.name"; //$NON-NLS-1$
+ public static final String LINUX = "linux"; //$NON-NLS-1$
+ public static final String MAC = "mac"; //$NON-NLS-1$
+ public static final String WIN = "win"; //$NON-NLS-1$
+
+ private static String logPostFix = null;
+
+ public static String getLogPostFix() {
+ return logPostFix;
+ }
+
+ public static void setLogPostFix(String postFix) {
+ logPostFix = postFix;
+ }
+
+ public static String getRegistryValue(String node, String key) {
+ BufferedReader br = null;
+ String value = ""; //$NON-NLS-1$
+
+ String query = "reg query " + "\"" + node + "\" /v " + "\"" + key + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ try {
+ Process process = Runtime.getRuntime().exec(query);
+ String encoding = System.getProperty("sun.jnu.encoding"); //$NON-NLS-1$
+
+ br = new BufferedReader(new InputStreamReader(
+ process.getInputStream(), encoding));
+
+ String line = null;
+ while ((line = br.readLine()) != null) {
+ int index = line.indexOf("REG_SZ"); //$NON-NLS-1$
+ if (index >= 0) {
+ value = line.substring(index + "REG_SZ".length()).trim(); //$NON-NLS-1$
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return value;
+ }
+
+ public static String getTizenSdkDataPath() {
+ String defaultPath = null;
+ if (isWin()) {
+ defaultPath = getRegistryValue(WIN_INSTALL_NODE, WIN_INSTALL_KEY)
+ + File.separator + TIZEN_SDK_DATA;
+ } else if (isMac()) {
+ defaultPath = System.getenv(LINUX_INSTALL_ENV) + File.separator
+ + TIZEN_SDK_DATA;
+ } else if (isLinux()) {
+ defaultPath = System.getenv(LINUX_INSTALL_ENV) + File.separator
+ + TIZEN_SDK_DATA;
+ } else {
+ System.out.println("Please check OS and install the Tizen SDK"); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ return defaultPath;
+ }
+
+ public static String getDefaultRoot() {
+ String rootPath = null;
+ BufferedReader br = null;
+ String line = null;
+ try {
+ rootPath = TIZEN_SDK_DATA_PATH + File.separator + INSTALL;
+ File file = new File(rootPath);
+ if (!file.isFile()) {
+ return null;
+ }
+ br = new BufferedReader(new InputStreamReader(new FileInputStream(
+ file)));
+ line = br.readLine();
+ if (null == line) {
+ return null;
+ } else {
+ return line.substring(line.indexOf("=") + 1); //$NON-NLS-1$
+ }
+ } catch (IOException e) {
+ System.out.println("Fail to read."); //$NON-NLS-1$
+ e.printStackTrace();
+ } finally {
+ if (null != br) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return rootPath;
+ }
+
+ public static String getInstallPath() {
+ String installPath = TIZEN_ROOT_PATH;
+ if (null != installPath) {
+ installPath += File.separator + TOOLS_FOLDER_NAME + File.separator
+ + DYNAMIC_ANALYZER_FOLDER_NAME;
+ }
+ return installPath;
+ }
+
+ public static String getSavePath() {
+ String savePath = TIZEN_SDK_DATA_PATH;
+ if (null != savePath) {
+ savePath += File.separator + DYNAMIC_ANALYZER_FOLDER_NAME
+ + File.separator + SAVE_FOLDER_NAME;
+ }
+ return savePath;
+ }
+
+ public static String getLogsPath() {
+ String savePath = TIZEN_SDK_DATA_PATH + File.separator
+ + DYNAMIC_ANALYZER_FOLDER_NAME + File.separator;
+ if (null != savePath) {
+ savePath += LOG_FOLDER_NAME;
+ }
+ return savePath;
+ }
+
+ public static String getSdbPath() {
+ String path = TIZEN_ROOT_PATH;
+ if (null != path) {
+ path += File.separator + "tools" + File.separator + "sdb"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return path;
+ }
+
+ public static String getConfigFolderPath() {
+ String configFolderPath = DYNAMIC_ANALYZER_INSTALL_PATH;
+ if (null != configFolderPath) {
+ configFolderPath += File.separator + CONFIG_FOLDER_NAME;
+ }
+ return configFolderPath;
+ }
+
+ public static String getConfigFilePath() {
+ String configFilePath = CONFIG_FOLDER_PATH;
+
+ if (null != configFilePath) {
+ configFilePath += File.separator + CONFIG_FILE_NAME;
+ }
+ return configFilePath;
+ }
+
+ public static void pathCheck() {
+ if (null == TIZEN_ROOT_PATH) {
+ System.out.println("Tizen Root Path is null"); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ }
+
+ private static String getOS() {
+ return System.getProperty(OS_KEY).toLowerCase();
+ }
+
+ public static boolean isLinux() {
+ return getOS().indexOf(LINUX) >= 0;
+ }
+
+ public static boolean isMac() {
+ return getOS().indexOf(MAC) >= 0;
+ }
+
+ public static boolean isWin() {
+ return getOS().indexOf(WIN) >= 0;
+ }
+
+ public static List<String> getFiles(String dirPath) {
+ File dir = new File(dirPath);
+ if (!dir.isDirectory()) {
+ return null;
+ }
+ String[] fileList = dir.list();
+ List<String> list = new ArrayList<String>();
+ int fileListLength = fileList.length;
+ for (int i = 0; i < fileListLength; i++) {
+ File file = new File(dirPath + File.separator + fileList[i]);
+ if (!file.isDirectory()) {
+ list.add(fileList[i]);
+ }
+ }
+
+ return list;
+ }
+
+ public static boolean deleteFile(File file) {
+ if (file.isDirectory()) {
+ String[] children = file.list();
+ for (int i = 0; i < children.length; i++) {
+ boolean success = deleteFile(new File(file, children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+ // Directory is empty so delete
+ return file.delete();
+ }
+}
org.tizen.dynamicanalyzer.ui.toolbar.configuration,
org.tizen.dynamicanalyzer.ui.widgets,
org.tizen.dynamicanalyzer.utils
-Import-Package: org.tizen.sdblib
+Import-Package: org.tizen.common.sdb.command,
+ org.tizen.sdblib,
+ org.tizen.sdblib.exception,
+ org.tizen.sdblib.receiver,
+ org.tizen.sdblib.service,
+ org.tizen.sdblib.util
public static final String FUNCTION_USAGE_PROFILING_THREAD = "Function usage profiling thread"; //$NON-NLS-1$\r
public static final String USER_INTERFACE_PAGE_MANAGER_THREAD = "User Interface Page Managerthread"; //$NON-NLS-1$ \r
public static final String SQL_INSERTER_THREAD = "sql_inserter_thread"; //$NON-NLS-1$\r
+ public static final String HEART_BEAT_THREAD = "heart beat thread"; //$NON-NLS-1$\r
\r
/* log parsing token and callstack parsing token, etc... */\r
public static final String CALLSTACK_START = "callstack_start"; //$NON-NLS-1$\r
\r
/* timer intervals */\r
public static final int SOCKET_CHECK_INTERVAL = 10;\r
- public static final int SOCKET_TIMEOUT = 120000;\r
+ public static final int SOCKET_TIMEOUT = 5000;\r
public static final int SOCKET_FORWARD_INTERVAL = 1000;\r
public static final int LOG_CHECK_INTERVAL = 1000;\r
public static final int SAVE_PREPARE_TIME = 2000;\r
public static final int TIMER_INTERVAL_DEFAULT = 1000;\r
\r
/* project save index */\r
- public static final int PROJECT_VERSION_INDEX = 0;\r
+ public static final int PROJECT_APPNAME_INDEX = 0;\r
public static final int PROJECT_CREATE_TIME_INDEX = 1;\r
- public static final int PROJECT_APPNAME_INDEX = 2;\r
- public static final int PROJECT_DEVICE_INDEX = 3;\r
- public static final int PROJECT_LAST_DATA_INDEX = 4;\r
- public static final int PROJECT_LAST_TIME_INDEX = 5;\r
- public static final int PROJECT_TOTAL_SAMPLE_COUNT = 6;\r
- public static final int PROJECT_PKG_ID_INDEX = 7;\r
- public static final int PROJECT_STOP_TIME_INDEX = 8;\r
+ public static final int PROJECT_SAVE_PATH_INDEX = 2;\r
+ public static final int PROJECT_LAST_DATA_INDEX = 3;\r
+ public static final int PROJECT_VERSION_INDEX = 4;\r
+ public static final int PROJECT_DEVICE_INDEX = 5;\r
+ public static final int PROJECT_LAST_TIME_INDEX = 6;\r
+ public static final int PROJECT_STOP_TIME_INDEX = 7;\r
\r
/* save return values */\r
public static final int ERROR_EXTENSION_FAIL = -1;\r
public static final String MSG_VERSION = "999"; //$NON-NLS-1$\r
public static final String MSG_OK = "901"; //$NON-NLS-1$\r
public static final String MSG_NOT_OK = "902"; //$NON-NLS-1$\r
- public static final String MSG_WAIT = "903"; //$NON-NLS-1$\r
public static final String MSG_SNAPSHOT = "103"; //$NON-NLS-1$\r
\r
public static final int MSG_RECORD = 801;\r
// function usage profile data type\r
public final static int FUPD_APPLICATION = 1;\r
public final static int FUPD_DEPENDENT_LIB = 2;\r
+\r
+ public final static String DAEMONLOG_PREFIX = "da_daemon_log_";//$NON-NLS-1$\r
+ public final static int DAEMONLOG_COUNT = 3;\r
+\r
+ /*** version 3.0 */\r
+ public final static int MSG_KEEP_ALIVE = 0x0001;\r
+ public final static int MSG_START_SWAP = 0x0002;\r
+ public final static int MSG_STOP_SWAP = 0x0003;\r
+ public final static int MSG_CONFIG = 0x0004;\r
+ public final static int MSG_BINARY_INFO = 0x0005;\r
+ public final static int MSG_SWAP_INST = 0x0006;\r
+ public final static int MSG_TARGET_INFO = 0x0007;\r
+\r
+ public final static int MSG_KEEP_ALIVE_ACK = 0x1001;\r
+ public final static int MSG_START_ACK = 0x1002;\r
+ public final static int MSG_STOP_ACK = 0x1003;\r
+ public final static int MSG_CONFIG_ACK = 0x1004;\r
+ public final static int MSG_BINARY_INFO_ACK = 0x1005;\r
+ public final static int MSG_SWAP_INST_ACK = 0x1006;\r
+ public final static int MSG_TARGET_INFO_ACK = 0x1007;\r
+ public final static int MSG_WAIT_ACK = 0x1010;\r
+ \r
+ \r
+ /*** data channel messages */\r
+ public final static int MSG_DATA_PROCESS_INFO = 0x2002;\r
+ public final static int MSG_DATA_TERMINATE = 0x2004;\r
+ public final static int MSG_DATA_ERROR = 0x2005;\r
+ public final static int MSG_DATA_SAMPLE = 0x2006;\r
+ public final static int MSG_DATA_SYSTEM = 0x2007;\r
+ public final static int MSG_DATA_RECORD = 0x2009;\r
+ public final static int MSG_DATA_FUNCTION_ENTRY = 0x2010;\r
+ public final static int MSG_DATA_FUNCTION_EXIT = 0x2011;\r
+ public final static int MSG_DATA_CONTEXT_SWITCH_ENTRY = 0x2012;\r
+ public final static int MSG_DATA_CONTEXT_SWITCH_EXIT = 0x2013;\r
+ \r
+ public final static int MSG_PROBE_MEMORY = 0x3001;\r
+ public final static int MSG_PROBE_UICONTROL = 0x3002;\r
+ public final static int MSG_PROBE_UIEVENT = 0x3003;\r
+ public final static int MSG_PROBE_FILE = 0x3004;\r
+ public final static int MSG_PROBE_LIFECYCLE = 0x3005;\r
+ public final static int MSG_PROBE_SCREENSHOT = 0x3006;\r
+ public final static int MSG_PROBE_SCENE = 0x3007;\r
+ public final static int MSG_PROBE_THREAD = 0x3008;\r
+ public final static int MSG_PROBE_CUSTOM = 0x3009;\r
+ public final static int MSG_PROBE_SYNC = 0x3010;\r
+ \r
+ \r
}\r
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
import org.tizen.dynamicanalyzer.theme.DATheme;
import org.tizen.dynamicanalyzer.theme.DAThemeWhite;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
private static boolean isHaveSampleThread = false;
private static boolean exit = false;
- private static String startBinaryAddr = null;
- private static String endBinaryAddr = null;
+ private static long startBinaryAddr = -1;
+ private static long endBinaryAddr = -1;
public static final int THREAD_JOIN_WAIT_TIME = 5000;
}
public static boolean isBinStartEndSet() {
- if ((null != startBinaryAddr && !startBinaryAddr.isEmpty())
- && (null != endBinaryAddr && !endBinaryAddr.isEmpty())) {
+ if ((startBinaryAddr > 0) && (endBinaryAddr > 0)) {
return true;
}
return false;
}
- public static void setBinaryStartEndAddr(String start, String end) {
+ public static void setBinaryStartEndAddr(long start, long end) {
startBinaryAddr = start;
endBinaryAddr = end;
}
- public static boolean isInBinaryRange(String addrStr) {
- try {
- long startAddr = Long.parseLong(startBinaryAddr);
- long endAddr = Long.parseLong(endBinaryAddr);
- long addr = Long.parseLong(addrStr);
- if (addr > endAddr || addr < startAddr) {
- return false;
- }
- return true;
-
- } catch (NumberFormatException e) {
- e.printStackTrace();
+ public static boolean isInBinaryRange(long addr) {
+ if (addr > endBinaryAddr || addr < startBinaryAddr) {
return false;
}
-
+ return true;
}
public static void clear() {
FunctionUsageProfiler.clear();
FunctionUsageProfiler.stopProfiler();
RangeDataManager.getInstance().initRange();
- startBinaryAddr = null;
- endBinaryAddr = null;
+ startBinaryAddr = -1;
+ endBinaryAddr = -1;
appInfoArrived = false;
+ ApiNameManager.clear();
}
public static List<ImageInfo> getImageList() {
File fileList[] = file.listFiles(new ExtensionFilter(
CommonConstants.EXTENSION_LOG_CENTER));
- int fileListLength = fileList.length;
- if (1 > fileListLength) {
+ if (null == fileList || 1 > fileList.length) {
return null;
}
+ int fileListLength = fileList.length;
+
List<BaseLogCenter> logcs = new ArrayList<BaseLogCenter>();
BaseLogCenter logc = new BaseLogCenter();
for (int i = 0; i < fileListLength; i++) {
}
}
- public static List<LogCenter> getLogCenters() {
- if (null != project) {
- return project.getLogCenters();
- }
- return getInnerLogCenters();
- }
-
- public void initLogCenters() {
- if (null != logCenters) {
- logCenters.clear();
- } else {
- logCenters = new ArrayList<LogCenter>();
- }
-
- logCenters.addAll(AnalyzerManager.getLogCenters());
- }
-
- public static LogCenter getLogCenterById(int id) {
- List<LogCenter> logcs = getLogCenters();
- if (null != logcs) {
- int size = logcs.size();
- for (int i = 0; i < size; i++) {
- if (id == logcs.get(i).getId()) {
- return logcs.get(i);
- }
- }
- }
- return null;
- }
+ // public static List<LogCenter> getLogCenters() {
+ // if (null != project) {
+ // return project.getLogCenters();
+ // }
+ // return getInnerLogCenters();
+ // }
+
+ // public void initLogCenters() {
+ // if (null != logCenters) {
+ // logCenters.clear();
+ // } else {
+ // logCenters = new ArrayList<LogCenter>();
+ // }
+ //
+ // logCenters.addAll(AnalyzerManager.getLogCenters());
+ // }
+
+ // public static LogCenter getLogCenterById(int id) {
+ // List<LogCenter> logcs = getLogCenters();
+ // if (null != logcs) {
+ // int size = logcs.size();
+ // for (int i = 0; i < size; i++) {
+ // if (id == logcs.get(i).getId()) {
+ // return logcs.get(i);
+ // }
+ // }
+ // }
+ // return null;
+ // }
public static LeakCheckList getLeakCheckList() {
String path = AnalyzerPaths.DYNAMIC_ANALYZER_INSTALL_PATH
File fileList[] = file.listFiles(new ExtensionFilter(
CommonConstants.EXTENSION_LEAK_CHECK));
- int fileListLength = fileList.length;
- if (1 > fileListLength) {
+
+ if (null == fileList || 1 > fileList.length) {
return null;
}
+ int fileListLength = fileList.length;
+
LeakCheckList output = new LeakCheckList();
LeakCheckList leakCheckList = new LeakCheckList();
for (int i = 0; i < fileListLength; i++) {
}
public static boolean isOsp() {
- int type = Integer.parseInt(getProject().getAppInfo().get(
- AnalyzerConstants.APP_INFO_APP_TYPE));
+ int type = getProject().getApplicationType();
if (type == AnalyzerConstants.APP_TYPE_OSP) {
return true;
}
public static final String CMD_UPLOAD_FILE_LIST = "du -b " + //$NON-NLS-1$
AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN;
- public static final String DACOMMAND_KILL_MANAGER = "/usr/bin/da_command killmanager";
- public static final String DACOMMAND_KILL_APP = "/usr/bin/da_command killapp";
- public static final String DACOMMAND_RUN_MANAGER = "/usr/bin/da_command runmanager";
- public static final String DACOMMAND_RUN_EVENT = "/usr/bin/da_command runevent";
- public static final String DACOMMAND_FIND_UNITTEST = "/usr/bin/da_command findunittest";
+ public static final String DACOMMAND_KILL_MANAGER = "da killmanager";
+ public static final String DACOMMAND_KILL_APP = "da killapp";
+ public static final String DACOMMAND_RUN_MANAGER = "da runmanager";
+ public static final String DACOMMAND_RUN_EVENT = "da runevent";
+ public static final String DACOMMAND_FIND_UNITTEST = "da findunittest";
public static final String DACOMMAND_FIND_IME = "/usr/bin/pkginfo --arg-flt 10 http://tizen.org/category/ime";
+ public static final String DACOMMAND_CHECK_VERSION = "/usr/bin/da_command checkversion";
+
public static final String CMD_IS_ARM_ARCH = "uname -m"; //$NON-NLS-1$
public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$
}
package org.tizen.dynamicanalyzer.common;
-
public class CommonConstants {
/* special character */
public static final String OFF = "off"; //$NON-NLS-1$
public static final String PLUS = "+"; //$NON-NLS-1$
+ public static final String EOS = "\0";//$NON-NLS-1$
+
public static final String LOCAL_HOST = "127.0.0.1"; //$NON-NLS-1$
/* extensions */
public static final String LINUX = "linux"; //$NON-NLS-1$
public static final String MAC = "mac"; //$NON-NLS-1$
public static final String WIN = "win"; //$NON-NLS-1$
+
+ public final static int SHORT_SIZE = Short.SIZE / Byte.SIZE;
+ public final static int INT_SIZE = Integer.SIZE / Byte.SIZE;
+ public final static int LONG_SIZE = Long.SIZE / Byte.SIZE;
+ public final static int FLOAT_SIZE = Float.SIZE / Byte.SIZE;
+ public final static int DOUBLE_SIZE = Double.SIZE / Byte.SIZE;
+
}
private static int executeCommand(String[] cmds) {
int retValue = 0;
- try {
- if (cmds.length == 0) {
- retValue = -1;
- } else {
- runtime = Runtime.getRuntime();
- process = runtime.exec(cmds);
-
+ if (null == cmds) {
+ retValue = -1;
+ } else {
+ try {
+ if (cmds.length == 0) {
+ retValue = -1;
+ } else {
+ runtime = Runtime.getRuntime();
+ process = runtime.exec(cmds);
+
+ if (process != null) {
+ process.waitFor();
+ retValue = process.exitValue();
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
if (process != null) {
- process.waitFor();
- retValue = process.exitValue();
+ process.destroy();
}
}
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } finally {
- if (process != null) {
- process.destroy();
- }
}
return retValue;
}
FileLock fileLock = null;
FileChannel fchannel = null;
- file = new File(AnalyzerPaths.DA_SINGLETON_FILE_PATH);
- try {
- fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
- } catch (FileNotFoundException e1) {
- e1.printStackTrace();
- }
- try {
- fileLock = fchannel.tryLock();
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (fileLock == null) {
- return true;
- }
-
+ file = new File(AnalyzerPaths.DA_SINGLETON_FILE_PATH);
+ try {
+ fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
+ } catch (FileNotFoundException e1) {
+ e1.printStackTrace();
+ }
+ try {
+ fileLock = fchannel.tryLock();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (fileLock == null) {
+ return true;
+ }
+
return false;
}
--- /dev/null
+package org.tizen.dynamicanalyzer.common;
+
+public enum HostResult {
+ SUCCESS(0, "Success!"),
+
+ ERR_EXCEPTION_OCCURRED(-1, "Excpetion occurred "),
+
+ ERR_INVALID_VERSION(-2, "not supported version "),
+
+ ERR_REMOTE_PORT_GET_FAILED(-101, "remote port get failed!!"),
+
+ ERR_CONTROL_SOCKET_CREATION_FAIL(-102, "control socket creation is failed "),
+
+ ERR_DATA_SOCKET_CREATION_FAIL(-103, "control socket creation is failed "),
+
+ ERR_FILE_IS_NOT_EXISTS(-201, "File is not exist!"),
+
+ ERR_UPLOAD_FILE_FAILED(-202, "file upload is failed!"),
+
+ ERR_SDB_PUSH_FAILED(-203, "sdb push returns null"),
+
+ ERR_READELF_SIZE_GET_FAILED(-204, "readelf size get failed"),
+
+ ERR_READELF_UPLOAD_FAILED(-205, "readelf file size is different!!"),
+
+ ERR_DEVICE_IS_NULL(-301, "current device is null"),
+
+ ERR_DEVICE_IS_OFFLINE(-302, "current device is offline"),
+
+ ERR_SELECTED_APP_IS_NULL(-401, "selected app is null"),
+
+ ERR_MSG_START_FAIL(-501, "start message is not ok"),
+
+ ERR_MSG_STOP_FAIL(-502, "stop message is not ok"),
+
+ ERR_MSG_RUNTIME_FAIL(-503, "runtime message is not ok"),
+
+ ERR_MSG_SEND_FAIL(-504, "Communicator is not running"),
+
+ ERR_TARGET_INFO_GET_FAIL(-505, "target info get fail..."),
+
+ ERR_KEEP_ALIVE(-506, "keep alive message ack fail..."),
+
+ ERR_DA_IS_EXIT(-901, "Dynamic Analyzer is closing"),
+
+ ERR_UNDEFINED(-999, "Unknown error");
+
+ private String message;
+ private String method;
+ private final String errMsg;
+ private final int errNo;
+
+ public static final int ERROR_MSG_INDEX = 0;
+ public static final int ERROR_LENGTH_INDEX = 1;
+ public static final int ERROR_NUMBER_INDEX = 2;
+
+ private HostResult(int num, String msg) {
+ errNo = num;
+ errMsg = msg;
+ message = null;
+ method = null;
+ }
+
+ public int getErrorNumber() {
+ return errNo;
+ }
+
+ public String getMessage() {
+ if (null == message) {
+ return errMsg;
+ }
+ return message;
+ }
+
+ public static HostResult parseError(int num) {
+ HostResult[] errors = values();
+ for (int i = 0; i < errors.length; i++) {
+ if (errors[i].getErrorNumber() == num) {
+ return errors[i];
+ }
+ }
+ return HostResult.ERR_UNDEFINED;
+ }
+
+ @Override
+ public String toString() {
+ String str = "";
+ if (0 != errNo) {
+ str += "[ERROR : ";
+ } else {
+ str += "[SUCCESS : ";
+ }
+ str += (errMsg + "]");
+ if (null != message) {
+ str += ("\n[MESSAGE : " + message + "]");
+ }
+ return str;
+ }
+
+ private String getMethod() {
+ String str = "";
+ if (0 != errNo) {
+ str += "[ERROR : ";
+ } else {
+ str += "[SUCCESS : ";
+ }
+ str += (errMsg + " ");
+ if (null != method) {
+ str += ("METHOD : " + method + " ]");
+ }
+ return str;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+ public boolean equals(HostResult target) {
+ if (target.getErrorNumber() != errNo) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isSuccess() {
+ if (this.errNo == SUCCESS.getErrorNumber()) {
+ return true;
+ }
+ return false;
+ }
+
+ // depth is callstack depth
+ public static String getMethoName(int depth) {
+ StackTraceElement[] elements = null;
+
+ try {
+ throw new Exception("exception for method name");
+ } catch (Exception e) {
+ elements = e.getStackTrace();
+ }
+ String methodName = ((StackTraceElement) elements[depth])
+ .getMethodName();
+
+ return methodName;
+ }
+
+ public static String getClassName(int depth) {
+ StackTraceElement[] elements = null;
+
+ try {
+ throw new Exception("exception for method name");
+ } catch (Exception e) {
+ elements = e.getStackTrace();
+ }
+ String className = ((StackTraceElement) elements[depth]).getClassName();
+
+ return className;
+ }
+
+ public static String getFileName(int depth) {
+ StackTraceElement[] elements = null;
+
+ try {
+ throw new Exception("exception for method name");
+ } catch (Exception e) {
+ elements = e.getStackTrace();
+ }
+ String fileName = ((StackTraceElement) elements[depth]).getFileName();
+
+ return fileName;
+ }
+
+ public static HostResult printAndReturn(HostResult result) {
+ result.setMethod(getMethoName(2) + "()");
+ System.out.println(result.getMethod());
+ return result;
+ }
+}
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
br = new BufferedReader(new InputStreamReader(new FileInputStream(
file)));
line = br.readLine();
- return line.substring(line.indexOf(CommonConstants.EQUAL) + 1);
+ if (null == line) {
+ return null;
+ } else {
+ return line.substring(line.indexOf(CommonConstants.EQUAL) + 1);
+ }
+
} catch (IOException e) {
e.printStackTrace();
} finally {
+ File.separator + AnalyzerConstants.TIZEN_FOLDER_OSP;
}
String currentDevie = CommonConstants.EMPTY;
- if (DACommunicator.isCurrentDeviceArmArch()) {
+ if (CommunicatorUtils.isCurrentDeviceArmArch()) {
currentDevie = "device";//$NON-NLS-1$
} else {
currentDevie = "emulator";//$NON-NLS-1$
return null;
}
- if (files.length != 1) {
+ if (null == files || files.length != 1) {
return null;
}
String aboutFilePath = aboutFolderPath + File.separator + files[0]
import org.eclipse.cdt.debug.edc.symbols.IUnmangler;
import org.eclipse.cdt.utils.Addr32;
import org.eclipse.cdt.utils.elf.Elf;
+import org.eclipse.cdt.utils.elf.Elf.Symbol;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
return reader;
}
- public static SourceLine addr2line(String strPath, String strAddr,
+ public static SourceLine addr2line(String strPath, long address,
boolean isPieBuild, String strBaseAddr) {
Addr32 addr, baseAddr, offsetAddr;
IEDCSymbolReader reader;
return srcline;
}
- if (strAddr == null || strAddr.isEmpty()) {
+ if (address < 0) {
srcline.setError(AnalyzerConstants.SOURCELINE_NULL_ADDRESS);
return srcline;
}
}
try {
- addr = new Addr32(strAddr);
+ addr = new Addr32(Long.toString(address));
} catch (NumberFormatException e) {
srcline.setError(AnalyzerConstants.SOURCELINE_BAD_ADDRESS);
return srcline;
}
}
- return elf.getSymbol(addr).toString();
+ Symbol sym = elf.getSymbol(addr);
+ if (null == sym) {
+ return null;
+ }
+ return sym.toString();
}
public static String demanglingFunctionName(String mangled) {
String demangled = null;
unmangler = new UnmanglerEABI();
try {
- demangled = unmangler.unmangle(mangled);
+ demangled = unmangler.unmangle(mangled.trim());
} catch (UnmanglingException e) {
e.printStackTrace();
demangled = mangled;
--- /dev/null
+package org.tizen.dynamicanalyzer.communicator;
+
+import java.io.BufferedReader;
+import java.net.Socket;
+
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+
+public abstract class BaseCommunicator {
+
+ protected boolean blocked = false;
+
+ public abstract HostResult init();
+
+ public abstract HostResult startTrace();
+
+ public abstract HostResult sendRuntimeMessage(int type, String message);
+
+ public abstract HostResult stopTrace();
+
+ public abstract HostResult exit();
+
+ public abstract BufferedReader getDataBufferedReader();
+
+ public abstract void clear();
+
+ public abstract HostResult handleControlMessage(String message);
+
+ public boolean isBlocked() {
+ return blocked;
+ }
+
+ public void setBlock(boolean blocked) {
+ this.blocked = blocked;
+ }
+
+ public HostResult sendKeepAliveMessage(DeviceInfo device) {
+ return HostResult.SUCCESS;
+ }
+
+ public abstract Socket getDataSocket();
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.communicator;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
+
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.logparser.LogParser;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.swap.model.control.EventObject;
+import org.tizen.dynamicanalyzer.swap.model.control.ReplayEvent;
+import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
+import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
+
+public class Communicator22 extends BaseCommunicator {
+
+ protected int remotePort = -1;
+ private Socket controlSock = null;
+ private BufferedWriter controlWriter = null;
+ private BufferedReader controlReader = null;
+
+ private Socket dataSock = null;
+ private BufferedWriter dataWriter = null;
+ private BufferedReader dataReader = null;
+
+ @Override
+ public HostResult init() {
+ controlSock = null;
+ dataSock = null;
+ controlWriter = null;
+ controlReader = null;
+ dataWriter = null;
+ dataReader = null;
+ remotePort = -1;
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public HostResult startTrace() {
+ HostResult result = connectionProcess();
+ if (!result.equals(HostResult.SUCCESS)) {
+ System.out.println(result.toString());
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance().setStartButtonEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
+ }
+ });
+ return result;
+ }
+
+ if (!AnalyzerManager.isExit()) {
+ result = sendStartMessage();
+ if (!result.isSuccess()) {
+ DACommunicator.setRunning(false);
+ return result;
+ }
+
+ UIRecorderTool.getInstance().startRecorder();
+ ToolbarArea.getInstance().startTimer();
+ LogParser.startLogParser();
+ FileChartManager.getInstance().startUpdateLogThread();
+ ThreadChartManager.getInstance().startUpdateLogThread();
+ UIDataManager.getInstance().startUpdateLogThread();
+ FunctionUsageProfiler.startProfiler();
+
+ /* Timeline */
+ UpdateViewTimer.start();
+ System.out
+ .println("Start recorder, timer, log parser, file, thread, ui, profile , update timer");
+ result = HostResult.SUCCESS;
+ result.setMessage("start trace");
+ } else {
+ result = HostResult.ERR_DA_IS_EXIT;
+ }
+ return result;
+ }
+
+ @Override
+ public HostResult sendRuntimeMessage(int type, String msg) {
+ int state = ConfigureManager.getInstance().getConfiguration();
+ String statestr = Integer.toString(state);
+ String message = AnalyzerConstants.MSG_OPTION
+ + CommonConstants.CMD_SPLIT + statestr.length()
+ + CommonConstants.CMD_SPLIT + statestr;
+
+ HostResult result = handleControlMessage(message);
+ if (result.equals(HostResult.SUCCESS)) {
+ System.out.println("snapshot message ack :" + result.getMessage());
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return result;
+ } else {
+ result = HostResult.ERR_MSG_RUNTIME_FAIL;
+ result.setMessage(new String(splitResult[0]));
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public HostResult stopTrace() {
+ return sendStopMessage();
+ }
+
+ @Override
+ public HostResult exit() {
+ return HostResult.SUCCESS;
+ }
+
+ private HostResult sendStartMessage() {
+ int isArm = 0;
+ int isEmul = 0;
+ int res = 0;
+
+ ReplayEvent rep = new ReplayEvent();
+ rep.getEventObjects().add(new EventObject());
+ rep.getEventObjects().add(new EventObject());
+ byte[] test = rep.getByteValue();
+
+ if (!CommunicatorUtils.isCurrentDeviceArmArch()) {
+ isArm = 1;
+ }
+
+ DeviceInfo device = DACommunicator.getSelectedDevice();
+ if (null != device
+ && device.getIDevice().getSerialNumber()
+ .startsWith(CommonConstants.EMULATOR)) {
+ isEmul = 1;
+ }
+
+ if (null == DACommunicator.getSelectedApp()) {
+ return HostResult.ERR_SELECTED_APP_IS_NULL;
+ }
+ String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
+ + CommonConstants.CMD_SPLIT
+ + ConfigureManager.getInstance().getConfiguration()
+ + CommonConstants.CMD_SPLIT
+ + DACommunicator.getSelectedApp().getInfo(AppInfo.EXEC_INDEX);
+
+ String message = AnalyzerConstants.MSG_START
+ + CommonConstants.CMD_SPLIT + rearMessage.length()
+ + CommonConstants.CMD_SPLIT + rearMessage;
+ System.out.println("Send message :" + message); //$NON-NLS-1$
+
+ HostResult result = handleControlMessage(message);
+ if (result.equals(HostResult.SUCCESS)) {
+ System.out.println("start message ack :" + result.getMessage());
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return result;
+ } else {
+ result = HostResult.ERR_MSG_START_FAIL;
+ result.setMessage(new String(splitResult[0]));
+ }
+ }
+ return result;
+ }
+
+ private HostResult sendStopMessage() {
+ HostResult result = null;
+
+ if (DACommunicator.isRunning()) {
+ String message = AnalyzerConstants.MSG_STOP
+ + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
+ System.out.println("stop send message :" + message);
+
+ result = handleControlMessage(message);
+ if (result.equals(HostResult.SUCCESS)) {
+ System.out.println("stop message ack :" + result.getMessage());
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return result;
+ } else {
+ result = HostResult.ERR_MSG_STOP_FAIL;
+ result.setMessage(new String(splitResult[0]));
+ }
+ }
+ } else {
+ result = HostResult.ERR_MSG_SEND_FAIL;
+ }
+ return result;
+ }
+
+ public HostResult handleControlMessage(String message) {
+ HostResult result = null;
+ String str = null;
+ try {
+ if (null != controlSock && !controlSock.isClosed()) {
+ controlWriter.write(message);
+ controlWriter.flush();
+ }
+
+ System.out.println("wait for ack... [send message : " + message
+ + " ]");
+ while (DACommunicator.isRunning()) {
+ char cbuf[] = new char[64];
+ blocked = true;
+ int readsize = controlReader.read(cbuf);
+ blocked = false;
+ if (readsize > 0) {
+ str = String.copyValueOf(cbuf, 0, readsize);
+ if (null != str && !str.isEmpty()) {
+ result = HostResult.SUCCESS;
+ result.setMessage(str);
+ break;
+ }
+ }
+ }
+ } catch (SocketException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } catch (SocketTimeoutException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } finally {
+ blocked = false;
+ }
+ return result;
+ }
+
+ private HostResult connectionProcess() {
+ HostResult result = null;
+ // step 1. check readelf and upload
+ if (CommunicatorUtils.getReadelfSize() < 0) {
+ System.out.println("upload readelf");
+ result = CommunicatorUtils.uploadReadElf();
+ System.out.println(result.toString());
+ if (!result.isSuccess()) {
+ return result;
+ }
+ }
+
+ // step 2. run da_manager
+ CommunicatorUtils
+ .execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
+
+ // step 3. get remote port from /tmp/port.da in device or emul
+ remotePort = CommunicatorUtils.getRemotePort(DACommunicator
+ .getSelectedDevice().getIDevice());
+ if (remotePort < 0) {
+ return HostResult.ERR_REMOTE_PORT_GET_FAILED;
+ }
+
+ // step 4. port foward
+ result = CommunicatorUtils.foward(CommunicatorUtils.LOCAL_PORT,
+ remotePort);
+ System.out.println(result.toString());
+ if (!HostResult.SUCCESS.equals(result)) {
+ return result;
+ }
+
+ // step 5. set da_communicator is running!
+ DACommunicator.setRunning(true);
+
+ // step 6. create sockets
+
+ result = createControlSocket(CommunicatorUtils.LOCAL_PORT);
+ if (!result.equals(HostResult.SUCCESS)) {
+ DACommunicator.setRunning(false);
+ System.out.println(result.toString());
+ return result;
+ }
+
+ result = createDataSocket(CommunicatorUtils.LOCAL_PORT);
+ if (!result.equals(HostResult.SUCCESS)) {
+ DACommunicator.setRunning(false);
+ System.out.println(result.toString());
+ return result;
+ }
+
+ return HostResult.printAndReturn(HostResult.SUCCESS);
+ }
+
+ private HostResult createControlSocket(int port) {
+ HostResult result = HostResult.SUCCESS;
+ try {
+ controlSock = new Socket(CommonConstants.LOCAL_HOST, port);
+ if (null == controlSock) {
+ result = HostResult.ERR_CONTROL_SOCKET_CREATION_FAIL;
+ System.out.println(result.toString());
+ return result;
+ }
+
+ controlSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ controlSock.setReuseAddress(true);
+ controlSock.setTcpNoDelay(true);
+
+ controlReader = new BufferedReader(new InputStreamReader(
+ controlSock.getInputStream()));
+ controlWriter = new BufferedWriter(new OutputStreamWriter(
+ controlSock.getOutputStream()));
+ } catch (SocketTimeoutException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ System.out.println(result.toString());
+ e.printStackTrace();
+ } catch (UnknownHostException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private HostResult createDataSocket(int port) {
+ HostResult result = HostResult.SUCCESS;
+ try {
+ dataSock = new Socket(CommonConstants.LOCAL_HOST, port);
+ if (null == dataSock) {
+ result = HostResult.ERR_DATA_SOCKET_CREATION_FAIL;
+ System.out.println(result.toString());
+ return result;
+ }
+
+ dataSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ dataSock.setReuseAddress(true);
+ dataSock.setTcpNoDelay(true);
+
+ dataReader = new BufferedReader(new InputStreamReader(
+ dataSock.getInputStream()));
+ dataWriter = new BufferedWriter(new OutputStreamWriter(
+ dataSock.getOutputStream()));
+
+ new Thread(null, new ReceiveCommunicator(),
+ AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD).start();
+ System.out.println("Receive Thread start");
+ } catch (SocketTimeoutException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ System.out.println(result.toString());
+ e.printStackTrace();
+ } catch (UnknownHostException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public void closeSocket() {
+ AnalyzerUtil.tryClose(dataReader, dataWriter, dataSock, controlReader,
+ controlWriter, controlSock);
+ }
+
+ @Override
+ public BufferedReader getDataBufferedReader() {
+ return dataReader;
+ }
+
+ @Override
+ public void clear() {
+ closeSocket();
+ CommunicatorUtils.unfoward(CommunicatorUtils.LOCAL_PORT, remotePort);
+ }
+
+ public Socket getDataSocket() {
+ return dataSock;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.communicator;
+
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+import static org.tizen.sdblib.util.DeviceUtil.isOnline;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.common.sdb.command.SdbCommand;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.IShellOutputReceiver;
+import org.tizen.sdblib.exception.SdbCommandRejectedException;
+import org.tizen.sdblib.exception.ShellCommandUnresponsiveException;
+import org.tizen.sdblib.exception.TimeoutException;
+import org.tizen.sdblib.receiver.MultiLineReceiver;
+import org.tizen.sdblib.receiver.NullOutputReceiver;
+import org.tizen.sdblib.service.FileEntry;
+import org.tizen.sdblib.service.ISyncProgressMonitor;
+import org.tizen.sdblib.service.NullSyncProgressMonitor;
+import org.tizen.sdblib.service.SyncResult;
+import org.tizen.sdblib.service.SyncService;
+
+public class CommunicatorUtils {
+ private static List<String> uploadDataResult = new ArrayList<String>();
+ private static boolean isArch = false;
+ private static final int PORT_WAIT_TIME = 5;
+ private static List<String> portLines = new ArrayList<String>();
+ public static final int LOCAL_PORT = 8000;
+
+ public static long getReadelfSize() {
+ long ret = -1;
+ getUploadDataResult().clear();
+ execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ for (int i = 0; i < lines.length; i++) {
+ getUploadDataResult().add(lines[i]);
+ }
+ }
+ });
+ if (getUploadDataResult().isEmpty()) {
+ return ret;
+ }
+
+ String duResult = getUploadDataResult().get(0);
+ if (!duResult.contains("cannot access")) {
+ String[] splitResult = duResult.split("\\/"); //$NON-NLS-1$
+ duResult = new String(splitResult[0].trim());
+ ret = Long.parseLong(duResult);
+ }
+ return ret;
+ }
+
+ public static HostResult uploadReadElf() {
+ long readelfSize = -1;
+ String readelf = AnalyzerPaths.READELF_PATH;
+ HostResult result = null;
+
+ if (isCurrentDeviceArmArch()) {
+ readelf += CommonConstants.ARM_ARCH;
+ } else {
+ readelf += CommonConstants.X86_ARCH;
+ }
+ String source = readelf + File.separator
+ + AnalyzerConstants.READELF_BIN;
+ File file = new File(source);
+ if (file.exists()) {
+ readelfSize = file.length();
+ } else {
+ System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
+ return HostResult.ERR_FILE_IS_NOT_EXISTS;
+ }
+
+ result = uploadFile(DACommunicator.getSelectedDevice().getIDevice(),
+ source, AnalyzerPaths.DA_REMOTE_PATH
+ + AnalyzerConstants.READELF_BIN);
+ if (!result.isSuccess()) {
+ return result;
+ }
+
+ // readelf
+ long uploadSize = getReadelfSize();
+ if (uploadSize < 0) {
+ return HostResult.ERR_READELF_SIZE_GET_FAILED;
+ }
+ if (readelfSize != uploadSize) {
+ System.out.println("readelf file size is different!! "); //$NON-NLS-1$
+ return HostResult.ERR_READELF_UPLOAD_FAILED;
+ }
+ return HostResult.printAndReturn(result);
+ }
+
+ public static boolean isCurrentDeviceArmArch() {
+ execHostCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ if (lines[0].contains(CommonConstants.ARM_ARCH)) {
+ isArch = true;
+ } else {
+ isArch = false;
+ }
+ }
+ });
+
+ return isArch;
+ }
+
+ private static List<String> getUploadDataResult() {
+ if (null == uploadDataResult) {
+ uploadDataResult = new ArrayList<String>();
+ }
+ return uploadDataResult;
+ }
+
+ public static void execShellCommand(String command) {
+ execShellCommand(command, NullOutputReceiver.getInstance());
+ }
+
+ public static void execShellCommand(String command,
+ IShellOutputReceiver receiver) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ currentDevice.getIDevice().executeShellCommand(command,
+ receiver);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void execShellCommand(IDevice device, String command,
+ IShellOutputReceiver receiver) {
+ if (null != device && isOnline(device)) {
+ try {
+ device.executeShellCommand(command, receiver);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static HostResult uploadFile(IDevice device, String source,
+ String targetPath) {
+ HostResult ret = HostResult.SUCCESS;
+ SyncResult result = push(device, source, targetPath);
+ if (null == result || RESULT_OK != result.getCode()) {
+ System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null != result) {
+ ret = HostResult.ERR_UPLOAD_FILE_FAILED;
+ ret.setMessage(result.getMessage());
+ System.out.println(ret.toString() + " : " + ret.getMessage()); //$NON-NLS-1$
+ } else {
+ ret = HostResult.ERR_SDB_PUSH_FAILED;
+ System.out.println(ret.toString());
+ }
+ return ret;
+ }
+ return ret;
+ }
+
+ public static SyncResult push(IDevice device, String local, String remote) {
+ return push(device, local, remote,
+ NullSyncProgressMonitor.getInstance());
+ }
+
+ public static SyncResult push(IDevice currentDevice, String local,
+ String remote, ISyncProgressMonitor monitor) {
+ SyncResult result = null;
+ if (null != currentDevice && isOnline(currentDevice)) {
+ try {
+ SyncService service = currentDevice.getSyncService();
+ if (null != service) {
+ result = service.push(new String[] { local },
+ currentDevice.getFileEntry(remote), monitor);
+ }
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ public static SyncResult pull(String local, String remote) {
+ return pull(local, remote, NullSyncProgressMonitor.getInstance());
+ }
+
+ public static SyncResult pull(String remote, String local,
+ ISyncProgressMonitor monitor) {
+ SyncResult result = null;
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ SyncService service = currentDevice.getIDevice()
+ .getSyncService();
+ if (null != service) {
+ result = service.pull(new FileEntry[] { currentDevice
+ .getIDevice().getFileEntry(remote) }, local,
+ monitor);
+ }
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ public static Process execCommand(IDevice device, String command) {
+ if (null != device && isOnline(device)) {
+ try {
+ return device.executeShellCommand(command, false);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return null;
+ }
+
+ public static int getRemotePort(IDevice device) {
+ int count = 0;
+ int remotePort = -1;
+ // add error check
+ while (count < PORT_WAIT_TIME) {
+ try {
+ execShellCommand(device,
+ AnalyzerShellCommands.CMD_CAT_PORT_FILE,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ portLines.clear();
+ for (int i = 0; i < lines.length; i++) {
+ portLines.add(lines[i]);
+ }
+ }
+ });
+ if (!portLines.isEmpty()) {
+ String line = portLines.get(0);
+ System.out.println("port : " + line);
+ try {
+ remotePort = Integer.parseInt(line);
+ System.out
+ .println("port get success!! : " + remotePort);
+ break;
+ } catch (NumberFormatException e) {
+ System.out.print("port is invalid...");
+ }
+ }
+ count++;
+ System.out.print("wait for port..");
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ return remotePort;
+ }
+
+ public static HostResult foward(int local, int remote) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ HostResult result = HostResult.SUCCESS;
+ result.setMessage("foward " + local + " to " + remote + " complete!");
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ currentDevice.getIDevice().createForward(local, remote);
+ Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ }
+ } else if (null == currentDevice) {
+ result = HostResult.ERR_DEVICE_IS_NULL;
+ } else if (!isOnline(currentDevice.getIDevice())) {
+ result = HostResult.ERR_DEVICE_IS_OFFLINE;
+ } else {
+ result = HostResult.ERR_UNDEFINED;
+ }
+ return result;
+ }
+
+ public static void unfoward(int local, int remote) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ System.out.println("unfoward!!");
+ currentDevice.getIDevice().removeForward(local, remote);
+ Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void removeCommand(String path) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ currentDevice.getIDevice().executeShellCommand(
+ AnalyzerShellCommands.CMD_REMOVE
+ + CommonConstants.SPACE + path,
+ NullOutputReceiver.getInstance());
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void execHostCommand(String command,
+ IShellOutputReceiver receiver) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ currentDevice.getIDevice()
+ .executeHostCommand(command, receiver);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static Process execCommand(String command) {
+ DeviceInfo currentDevice = DACommunicator.getSelectedDevice();
+ SdbCommand sdbCmd;
+ if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
+ try {
+ sdbCmd = new SdbCommand(currentDevice.getIDevice());
+ return sdbCmd.runHostCommand(command, false);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return null;
+ }
+}
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
package org.tizen.dynamicanalyzer.communicator;
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+import static org.tizen.sdblib.util.DeviceUtil.isOnline;
+
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
import java.net.Socket;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-import java.net.UnknownHostException;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
-import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
+import org.tizen.dynamicanalyzer.swap.communicator.Communicator30;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.sdblib.IDevice;
-import org.tizen.sdblib.IShellOutputReceiver;
-import org.tizen.sdblib.MultiLineReceiver;
-import org.tizen.sdblib.NullOutputReceiver;
-import org.tizen.sdblib.SdbCommandRejectedException;
-import org.tizen.sdblib.ShellCommandUnresponsiveException;
+import org.tizen.sdblib.IDeviceChangeListener;
import org.tizen.sdblib.SmartDevelopmentBridge;
-import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
-import org.tizen.sdblib.SyncService;
-import org.tizen.sdblib.SyncService.ISyncProgressMonitor;
-import org.tizen.sdblib.SyncService.SyncResult;
-import org.tizen.sdblib.TimeoutException;
+import org.tizen.sdblib.receiver.MultiLineReceiver;
+import org.tizen.sdblib.service.SyncResult;
+import org.tizen.common.sdb.command.SdbCommand;
public class DACommunicator {
- /* Port */
- public static final int LOCAL_PORT = 8000;
- protected static int remotePort = -1;
- private static final int PORT_WAIT_TIME = 5;
- private static List<String> portLines = new ArrayList<String>();
+ public static int MSG_TYPE_CONFIG = 0;
+ public static int MSG_TYPE_SWAP_INST = 1;
- private static boolean blocked = false;
+ private static BaseCommunicator communicator = null;
- private static Socket controlSock = null;
- private static BufferedWriter controlWriter = null;
- private static BufferedReader controlReader = null;
-
- private static Socket sock = null;
- private static BufferedWriter writer = null;
- private static BufferedReader reader = null;
+ private static Communicator22 communicator_211 = new Communicator22();
+ private static Communicator30 communicator_30 = new Communicator30();
private static SmartDevelopmentBridge sdbBridge = null;
private static List<String> unittestList = new ArrayList<String>();
private static List<String> imeList = new ArrayList<String>();
private static List<String> uploadDataResult = new ArrayList<String>();
+ private static List<String> checkVersionResult = new ArrayList<String>();
private static boolean isRunning = false;
- public static void init() {
- SmartDevelopmentBridge.init();
- setNewBridge();
- sock = null;
- selectedApp = null;
- currentDevice = null;
- writer = null;
- reader = null;
- isRunning = false;
- devices = null;
- isArch = false;
- packageInfoMultiLines.clear();
- filterMultiLines.clear();
- uploadDataResult.clear();
- unittestList.clear();
- remotePort = -1;
- }
-
- public static boolean connectionProcess() {
- // step 1. check readelf and upload
- if (getReadelfSize() < 0) {
- System.out.println("upload readelf");
- if (!uploadReadElf()) {
- System.out.println("Failed to upload files..."); //$NON-NLS-1$
- return false;
- }
- }
-
- // step 2. run da_manager
- execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
-
- // step 3. get remote port from /tmp/port.da in device or emul
- if (!initRemotePort()) {
- return false;
+ public static HostResult checkVersion() {
+ HostResult result = HostResult.SUCCESS;
+ DeviceInfo currentDevice = getSelectedDevice();
+ if (null == currentDevice) {
+ return HostResult.ERR_DEVICE_IS_NULL;
}
+ String version = currentDevice.getTargetVersion();
- // step 4. port foward
- foward(LOCAL_PORT, remotePort);
-
- // step 5. set da_communicator is running!
- setRunning(true);
-
- // step 6. create data socket
- if (null == createControlSocket(LOCAL_PORT)) {
- System.out.println("control socket creation failed."); //$NON-NLS-1$
- setRunning(false);
- return false;
+ if (version.contains("3.0")) {
+ communicator = communicator_30;
+ } else if (version.contains("2.1.1")) {
+ communicator = communicator_211;
} else {
- System.out.println("control socket create success!!");
- }
+ result = HostResult.ERR_INVALID_VERSION;
- if (null == createSocket(LOCAL_PORT)) {
- System.out.println("data socket creation failed."); //$NON-NLS-1$
- setRunning(false);
- return false;
- } else {
- System.out.println("data socket create success!!");
+ // TODO : delete this temporary codes
+ communicator = communicator_211;
+ result = HostResult.SUCCESS;
}
- return true;
+ return result;
}
- protected static boolean initRemotePort() {
- int count = 0;
- boolean ret = false;
- // add error check
- while (count < PORT_WAIT_TIME) {
- try {
- execShellCommand(AnalyzerShellCommands.CMD_CAT_PORT_FILE,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- portLines.clear();
- for (int i = 0; i < lines.length; i++) {
- portLines.add(lines[i]);
- }
- }
- });
- if (!portLines.isEmpty()) {
- String line = portLines.get(0);
- System.out.println("port : " + line);
- try {
- remotePort = Integer.parseInt(line);
- System.out
- .println("port get success!! : " + remotePort);
- ret = true;
- break;
- } catch (NumberFormatException e) {
- System.out.print("port is invalid...");
- }
- }
- count++;
- System.out.print("wait for port..");
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- break;
- }
- }
- return ret;
+ public static void init() {
+ communicator.init();
}
- public static int getRemotePort() {
- return remotePort;
+ public static HostResult startTrace() {
+ return communicator.startTrace();
}
- public static boolean sendStartMessage() {
- int isArm = 0;
- int isEmul = 0;
- int res = 0;
-
- if (!isCurrentDeviceArmArch()) {
- isArm = 1;
- }
-
- DeviceInfo device = getSelectedDevice();
- if (null != device
- && device.getIDevice().getSerialNumber()
- .startsWith(CommonConstants.EMULATOR)) {
- isEmul = 1;
- }
-
- if (null == getSelectedApp()) {
- return false;
- }
- String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
- + CommonConstants.CMD_SPLIT + getConfiguration()
- + CommonConstants.CMD_SPLIT
- + getSelectedApp().getInfo(AppInfo.EXEC_INDEX);
-
- String message = AnalyzerConstants.MSG_START
- + CommonConstants.CMD_SPLIT + rearMessage.length()
- + CommonConstants.CMD_SPLIT + rearMessage;
- System.out.println("Send message :" + message); //$NON-NLS-1$
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("start message ack :" + result);
- String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
- } else {
- System.out
- .println("start message ack error :" + splitResult[1]);
- return false;
- }
- }
- return false;
+ public static HostResult sendRuntimeMessage(int type, String message) {
+ return communicator.sendRuntimeMessage(type, message);
}
- public static boolean sendStopMessage() {
- if (isRunning()) {
- String message = AnalyzerConstants.MSG_STOP
- + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
- System.out.println("stop send message :" + message);
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("stop message ack :" + result);
- String[] splitResult = result
- .split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
- } else {
- System.out.println("stop message ack error :"
- + splitResult[1]);
- return false;
- }
- }
- }
- return false;
+ public static HostResult stopTrace() {
+ return communicator.stopTrace();
}
- public static boolean sendSnapshotMessage(int state) {
- String statestr = Integer.toString(state);
- String message = AnalyzerConstants.MSG_OPTION
- + CommonConstants.CMD_SPLIT + statestr.length()
- + CommonConstants.CMD_SPLIT + statestr;
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("snapshot message ack :" + result);
- String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
- }
- }
- return false;
+ public static void exit() {
+ communicator.exit();
}
- public static int getConfiguration() {
- int state = 0;
-
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.FUNCTIONPROFILING);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.ALLOCATION);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.FILE);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.THREAD);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.USERINTERFACE);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.SNAPSHOT);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.EVENT);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.RECORDING);
-
- return state;
+ public static void reload() {
+ setNewBridge();
+ selectedApp = null;
+ currentDevice = null;
+ isRunning = false;
+ devices = null;
+ packageInfoMultiLines.clear();
+ filterMultiLines.clear();
+ uploadDataResult.clear();
+ unittestList.clear();
}
public static List<DeviceInfo> getDevices() {
selectedApp = app;
}
- public static Socket getSocket() {
- return sock;
- }
-
- public static void setSocket(Socket socket) {
- sock = socket;
- }
-
- public static SmartDevelopmentBridge getBridge() {
- return sdbBridge;
- }
-
- public static void setBridge(SmartDevelopmentBridge bridge) {
- sdbBridge = bridge;
- }
-
public static void setNewBridge() {
if (null != AnalyzerPaths.SDB_PATH) {
sdbBridge = SmartDevelopmentBridge.createBridge(
int size = devices.length;
if (size > 0) {
for (int i = 0; i < size; i++) {
- if (devices[i].isOnline()) {
+ if (isOnline(devices[i])) {
addDevice(devices[i]);
}
}
}
+ } else {
+ System.out.println("sdbbridge is null!");
}
}
private static void addDevice(IDevice device) {
DeviceInfo devInfo = new DeviceInfo(device);
- devices.add(devInfo);
+ HostResult result = readVersion(devInfo);
+ if (result.isSuccess()) {
+ System.out.println(result.toString());
+ devices.add(devInfo);
+ }
+ }
+
+ private static HostResult readVersion(DeviceInfo info) {
+ // checkVersionResult.clear();
+ // CommunicatorUtils.execShellCommand(
+ // AnalyzerShellCommands.DACOMMAND_CHECK_VERSION,
+ // new MultiLineReceiver() {
+ // @Override
+ // public void processNewLines(String[] appLines) {
+ // for (int i = 0; i < appLines.length; i++) {
+ // checkVersionResult.add(appLines[i]);
+ // }
+ // }
+ // });
+ // if (checkVersionResult.isEmpty()) {
+ // return HostResult.ERR_INVALID_VERSION;
+ // }
+
+ // String version = checkVersionResult.get(0);
+ String version = "2.1.1";
+ HostResult result = null;
+ // if (version.contains("3.0") || version.contains("2.1.1")) {
+ info.setTargetVersion(version);
+ // result = HostResult.SUCCESS;
+ // } else {
+ // result = HostResult.ERR_INVALID_VERSION;
+ // }
+
+ // TODO : fix temp code
+ result = HostResult.SUCCESS;
+ result.setMessage(version);
+ return result;
}
- private static boolean isArch = false;
-
- public static boolean isCurrentDeviceArmArch() {
- execShellCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- if (lines[0].contains(CommonConstants.ARM_ARCH)) {
- isArch = true;
- } else {
- isArch = false;
- }
- }
- });
-
- return isArch;
- }
+ // private static boolean isArch = false;
+
+ // public static boolean isCurrentDeviceArmArch() {
+ // execShellCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH,
+ // new MultiLineReceiver() {
+ // @Override
+ // public void processNewLines(String[] lines) {
+ // if (lines[0].contains(CommonConstants.ARM_ARCH)) {
+ // isArch = true;
+ // } else {
+ // isArch = false;
+ // }
+ // }
+ // });
+ //
+ // return isArch;
+ // }
protected static List<String> getDevicesNameList() {
List<String> devNameList = null;
packageInfoMultiLines.clear();
- execShellCommand(AnalyzerShellCommands.CMD_APPLICATION_LIST,
+ CommunicatorUtils.execShellCommand(
+ AnalyzerShellCommands.CMD_APPLICATION_LIST,
new MultiLineReceiver() {
@Override
public void processNewLines(String[] appLines) {
AppInfo.FLAG_ZERO)) {
String pkgId = pkgInfo.getInfo(AppInfo.PACKAGE_INDEX);
String appId = pkgInfo.getInfo(AppInfo.APPID_INDEX);
+
if (null == appInfoHash.get(pkgId)) {
if (!isUnittest(pkgId) && !isIME(appId)) {
appInfoList.add(pkgInfo);
String appInstallPath = currentDevice.getIDevice().getAppInstallPath();
filterMultiLines.clear();
- execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
+ CommunicatorUtils.execHostCommand(
+ AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
new MultiLineReceiver() {
@Override
public void processNewLines(String[] appLines) {
}
filterMultiLines.clear();
- execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_IME,
+ CommunicatorUtils.execShellCommand(
+ AnalyzerShellCommands.DACOMMAND_FIND_IME,
new MultiLineReceiver() {
@Override
public void processNewLines(String[] appLines) {
return null;
}
- public static Socket createSocket(int port) {
- try {
- sock = new Socket(CommonConstants.LOCAL_HOST, port);
- if (null == sock) {
- System.out.println("failed to create a socket"); //$NON-NLS-1$
- return null;
- } else {
- System.out.println("data socket create success!!");
- }
-
- sock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
- sock.setReuseAddress(true);
- sock.setTcpNoDelay(true);
-
- reader = new BufferedReader(new InputStreamReader(
- sock.getInputStream()));
- writer = new BufferedWriter(new OutputStreamWriter(
- sock.getOutputStream()));
-
- new Thread(null, new ReceiveCommunicator(),
- AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD).start();
-
- System.out.println("Receive Thread start");
- } catch (SocketTimeoutException e) {
- System.out.println("socket timeout."); //$NON-NLS-1$
- e.printStackTrace();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return sock;
- }
-
- public static Socket createControlSocket(int port) {
- try {
-
- controlSock = new Socket(CommonConstants.LOCAL_HOST, port);
- if (null == controlSock) {
- System.out.println("failed to create a control socket"); //$NON-NLS-1$
- return null;
- }
-
- controlSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
- controlSock.setReuseAddress(true);
- controlSock.setTcpNoDelay(true);
-
- controlReader = new BufferedReader(new InputStreamReader(
- controlSock.getInputStream()));
- controlWriter = new BufferedWriter(new OutputStreamWriter(
- controlSock.getOutputStream()));
- } catch (SocketTimeoutException e) {
- System.out.println("socket timeout."); //$NON-NLS-1$
- e.printStackTrace();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return controlSock;
- }
-
- public static void closeSocket() {
- AnalyzerUtil.tryClose(reader, writer, sock, controlReader,
- controlWriter, controlSock);
- }
-
- public static BufferedReader getSockBufferedReader() {
- return reader;
- }
-
- public static BufferedWriter getSockBufferedWriter() {
- return writer;
- }
-
- public static void foward(int local, int remote) {
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- currentDevice.getIDevice().createForward(local, remote);
- Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- public static void unfoward(int local, int remote) {
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- System.out.println("unfoward!!");
- currentDevice.getIDevice().removeForward(local, remote);
- Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- public static void execShellCommand(String command) {
- execShellCommand(command, new NullOutputReceiver());
- }
-
- public static void execShellCommand(String command,
- IShellOutputReceiver receiver) {
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- currentDevice.getIDevice().executeShellCommand(command,
- receiver);
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (ShellCommandUnresponsiveException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- public static Process execCommand(String command) {
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- return currentDevice.getIDevice().executeShellCommand(command,
- false);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- return null;
- }
-
- public static void sendMessage(String message) {
- try {
- if (null != sock) {
- writer.write(message);
- writer.flush();
- }
-
- } catch (IOException e) {
- System.out.println(e.getMessage());
- }
- }
-
- public static String handleControlMessage(String message) {
- String result = null;
- try {
- if (null != controlSock && !controlSock.isClosed()) {
- controlWriter.write(message);
- controlWriter.flush();
- }
-
- System.out.println("wait for ack... [send message : " + message
- + " ]");
- while (isRunning) {
- char cbuf[] = new char[64];
- blocked = true;
- int readsize = controlReader.read(cbuf);
- blocked = false;
- if (readsize > 0) {
- result = String.copyValueOf(cbuf, 0, readsize);
- if (null != result && !result.isEmpty()) {
- String[] splitResult = result
- .split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_WAIT.equals(splitResult[0])) {
- continue;
- } else {
- break;
- }
- }
- }
- }
- } catch (SocketException e) {
- e.printStackTrace();
- return null;
- } catch (SocketTimeoutException e) {
- e.printStackTrace();
- return null;
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- } finally {
- blocked = false;
- }
- return result;
- }
-
- public static SyncResult push(String local, String remote) {
- return push(local, remote, SyncService.getNullProgressMonitor());
- }
-
- public static SyncResult pull(String local, String remote) {
- return pull(local, remote, SyncService.getNullProgressMonitor());
- }
-
- public static SyncResult push(String local, String remote,
- ISyncProgressMonitor monitor) {
- SyncResult result = null;
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- SyncService service = currentDevice.getIDevice()
- .getSyncService();
- if (null != service) {
- result = service.pushFile(local, remote, monitor);
- }
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- return result;
- }
-
- public static SyncResult pull(String remote, String local,
- ISyncProgressMonitor monitor) {
- SyncResult result = null;
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- SyncService service = currentDevice.getIDevice()
- .getSyncService();
- if (null != service) {
- result = service.pullFile(remote, local, monitor);
- }
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- return result;
- }
+ // public static Socket createSocket(int port) {
+ // try {
+ // sock = new Socket(CommonConstants.LOCAL_HOST, port);
+ // if (null == sock) {
+ // System.out.println("failed to create a socket"); //$NON-NLS-1$
+ // return null;
+ // } else {
+ // System.out.println("data socket create success!!");
+ // }
+ //
+ // sock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ // sock.setReuseAddress(true);
+ // sock.setTcpNoDelay(true);
+ //
+ // reader = new BufferedReader(new InputStreamReader(
+ // sock.getInputStream()));
+ // writer = new BufferedWriter(new OutputStreamWriter(
+ // sock.getOutputStream()));
+ //
+ // new Thread(null, new ReceiveCommunicator(),
+ // AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD).start();
+ //
+ // System.out.println("Receive Thread start");
+ // } catch (SocketTimeoutException e) {
+ // System.out.println("socket timeout."); //$NON-NLS-1$
+ // e.printStackTrace();
+ // } catch (UnknownHostException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ //
+ // return sock;
+ // }
+
+ // public static Socket createControlSocket(int port) {
+ // try {
+ //
+ // controlSock = new Socket(CommonConstants.LOCAL_HOST, port);
+ // if (null == controlSock) {
+ // System.out.println("failed to create a control socket"); //$NON-NLS-1$
+ // return null;
+ // }
+ //
+ // controlSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ // controlSock.setReuseAddress(true);
+ // controlSock.setTcpNoDelay(true);
+ //
+ // controlReader = new BufferedReader(new InputStreamReader(
+ // controlSock.getInputStream()));
+ // controlWriter = new BufferedWriter(new OutputStreamWriter(
+ // controlSock.getOutputStream()));
+ // } catch (SocketTimeoutException e) {
+ // System.out.println("socket timeout."); //$NON-NLS-1$
+ // e.printStackTrace();
+ // } catch (UnknownHostException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ //
+ // return controlSock;
+ // }
+
+ // public static void closeSocket() {
+ // AnalyzerUtil.tryClose(reader, writer, sock, controlReader,
+ // controlWriter, controlSock);
+ // }
+
+ // public static BufferedReader getSockBufferedReader() {
+ // return reader;
+ // }
+
+ // public static BufferedWriter getSockBufferedWriter() {
+ // return writer;
+ // }
+
+ // public static void foward(int local, int remote) {
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // currentDevice.getIDevice().createForward(local, remote);
+ // Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // } catch (InterruptedException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // }
+
+ // public static void unfoward(int local, int remote) {
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // System.out.println("unfoward!!");
+ // currentDevice.getIDevice().removeForward(local, remote);
+ // Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // } catch (InterruptedException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // }
+
+ // public static void execShellCommand(String command) {
+ // execShellCommand(command, NullOutputReceiver.getInstance());
+ // }
+
+ // public static void execShellCommand(String command,
+ // IShellOutputReceiver receiver) {
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // currentDevice.getIDevice().executeShellCommand(command,
+ // receiver);
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (ShellCommandUnresponsiveException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // }
+
+ // public static Process execCommand(String command) {
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // return currentDevice.getIDevice().executeShellCommand(command,
+ // false);
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ //
+ // return null;
+ // }
+
+ // public static void sendMessage(String message) {
+ // try {
+ // if (null != sock) {
+ // writer.write(message);
+ // writer.flush();
+ // }
+ //
+ // } catch (IOException e) {
+ // System.out.println(e.getMessage());
+ // }
+ // }
+
+ // public static String handleControlMessage(String message) {
+ // String result = null;
+ // try {
+ // if (null != controlSock && !controlSock.isClosed()) {
+ // controlWriter.write(message);
+ // controlWriter.flush();
+ // }
+ //
+ // System.out.println("wait for ack... [send message : " + message
+ // + " ]");
+ // while (isRunning) {
+ // char cbuf[] = new char[64];
+ // blocked = true;
+ // int readsize = controlReader.read(cbuf);
+ // blocked = false;
+ // if (readsize > 0) {
+ // result = String.copyValueOf(cbuf, 0, readsize);
+ // if (null != result && !result.isEmpty()) {
+ // break;
+ // }
+ // }
+ // }
+ // } catch (SocketException e) {
+ // e.printStackTrace();
+ // return null;
+ // } catch (SocketTimeoutException e) {
+ // e.printStackTrace();
+ // return null;
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // return null;
+ // } finally {
+ // blocked = false;
+ // }
+ // return result;
+ // }
+
+ // public static SyncResult push(String local, String remote) {
+ // return push(local, remote, SyncService.getNullProgressMonitor());
+ // }
+
+ // public static SyncResult pull(String local, String remote) {
+ // return pull(local, remote, SyncService.getNullProgressMonitor());
+ // }
+
+ // public static SyncResult push(String local, String remote,
+ // ISyncProgressMonitor monitor) {
+ // SyncResult result = null;
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // SyncService service = currentDevice.getIDevice()
+ // .getSyncService();
+ // if (null != service) {
+ // result = service.pushFile(local, remote, monitor);
+ // }
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ //
+ // return result;
+ // }
+
+ // public static SyncResult pull(String remote, String local,
+ // ISyncProgressMonitor monitor) {
+ // SyncResult result = null;
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // SyncService service = currentDevice.getIDevice()
+ // .getSyncService();
+ // if (null != service) {
+ // result = service.pullFile(remote, local, monitor);
+ // }
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ //
+ // return result;
+ // }
public static void removeCommand(String path) {
- if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
- try {
- currentDevice.getIDevice().executeShellCommand(
- AnalyzerShellCommands.CMD_REMOVE
- + CommonConstants.SPACE + path,
- new NullOutputReceiver());
- } catch (TimeoutException e) {
- e.printStackTrace();
- } catch (SdbCommandRejectedException e) {
- e.printStackTrace();
- } catch (ShellCommandUnresponsiveException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ CommunicatorUtils.execShellCommand(AnalyzerShellCommands.CMD_REMOVE
+ + CommonConstants.SPACE + path);
+ // if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
+ // try {
+ // currentDevice.getIDevice().executeShellCommand(
+ // AnalyzerShellCommands.CMD_REMOVE
+ // + CommonConstants.SPACE + path,
+ // NullOutputReceiver.getInstance());
+ // } catch (TimeoutException e) {
+ // e.printStackTrace();
+ // } catch (SdbCommandRejectedException e) {
+ // e.printStackTrace();
+ // } catch (ShellCommandUnresponsiveException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
}
public static boolean isTargetEmulator() {
return false;
}
- private static boolean uploadFile(String source, String targetPath) {
-
- SyncResult result = push(source, targetPath);
- if (null == result || SyncService.RESULT_OK != result.getCode()) {
- System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("Error : " + result.getMessage()); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- public static boolean uploadReadElf() {
- long readelfSize = -1;
- String readelf = AnalyzerPaths.READELF_PATH;
-
- if (isCurrentDeviceArmArch()) {
- readelf += CommonConstants.ARM_ARCH;
- } else {
- readelf += CommonConstants.X86_ARCH;
- }
- String source = readelf + File.separator
- + AnalyzerConstants.READELF_BIN;
- File file = new File(source);
- if (file.exists()) {
- readelfSize = file.length();
- } else {
- System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
- return false;
- }
- if (!uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
- + AnalyzerConstants.READELF_BIN)) {
- return false;
- }
-
- // readelf
- long uploadSize = getReadelfSize();
- if (uploadSize < 0) {
- return false;
- }
- if (readelfSize != uploadSize) {
- System.out.println("readelf file size is different!! "); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- private static long getReadelfSize() {
- long ret = -1;
- getUploadDataResult().clear();
- execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
- uploadDataReceiver);
- if (getUploadDataResult().isEmpty()) {
- return ret;
- }
-
- String duResult = getUploadDataResult().get(0);
- if (!duResult.contains("cannot access")) {
- String[] splitResult = duResult.split("\\/"); //$NON-NLS-1$
- duResult = new String(splitResult[0].trim());
- ret = Long.parseLong(duResult);
- }
- return ret;
- }
-
- private static MultiLineReceiver uploadDataReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] appLines) {
- for (int i = 0; i < appLines.length; i++) {
- getUploadDataResult().add(appLines[i]);
- }
- }
- };
-
- private static List<String> getUploadDataResult() {
- if (null == uploadDataResult) {
- uploadDataResult = new ArrayList<String>();
- }
- return uploadDataResult;
- }
+ // private static boolean uploadFile(String source, String targetPath) {
+ //
+ // SyncResult result = push(source, targetPath);
+ // if (null == result || SyncService.RESULT_OK != result.getCode()) {
+ // System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
+ // if (null != result) {
+ // System.out.println("Error : " + result.getMessage()); //$NON-NLS-1$
+ // } else {
+ // System.out.println("push result is null!");
+ // }
+ // return false;
+ // }
+ // return true;
+ // }
+
+ // public static boolean uploadReadElf() {
+ // long readelfSize = -1;
+ // String readelf = AnalyzerPaths.READELF_PATH;
+ //
+ // if (isCurrentDeviceArmArch()) {
+ // readelf += CommonConstants.ARM_ARCH;
+ // } else {
+ // readelf += CommonConstants.X86_ARCH;
+ // }
+ // String source = readelf + File.separator
+ // + AnalyzerConstants.READELF_BIN;
+ // File file = new File(source);
+ // if (file.exists()) {
+ // readelfSize = file.length();
+ // } else {
+ // System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
+ // return false;
+ // }
+ // if (!uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
+ // + AnalyzerConstants.READELF_BIN)) {
+ // return false;
+ // }
+ //
+ // // readelf
+ // long uploadSize = getReadelfSize();
+ // if (uploadSize < 0) {
+ // return false;
+ // }
+ // if (readelfSize != uploadSize) {
+ // System.out.println("readelf file size is different!! "); //$NON-NLS-1$
+ // return false;
+ // }
+ // return true;
+ // }
+
+ // private static long getReadelfSize() {
+ // long ret = -1;
+ // getUploadDataResult().clear();
+ // execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
+ // uploadDataReceiver);
+ // if (getUploadDataResult().isEmpty()) {
+ // return ret;
+ // }
+ //
+ // String duResult = getUploadDataResult().get(0);
+ // if (!duResult.contains("cannot access")) {
+ // String[] splitResult = duResult.split("\\/"); //$NON-NLS-1$
+ // duResult = new String(splitResult[0].trim());
+ // ret = Long.parseLong(duResult);
+ // }
+ // return ret;
+ // }
+
+ // private static MultiLineReceiver uploadDataReceiver = new
+ // MultiLineReceiver() {
+ // @Override
+ // public void processNewLines(String[] appLines) {
+ // for (int i = 0; i < appLines.length; i++) {
+ // getUploadDataResult().add(appLines[i]);
+ // }
+ // }
+ // };
+
+ // private static List<String> getUploadDataResult() {
+ // if (null == uploadDataResult) {
+ // uploadDataResult = new ArrayList<String>();
+ // }
+ // return uploadDataResult;
+ // }
public static void addDeviceListener() {
SmartDevelopmentBridge.addDeviceChangeListener(deviceChanged);
SmartDevelopmentBridge.removeDeviceChangeListener(deviceChanged);
}
- public static void testDisConnected() {
- deviceChanged.deviceDisconnected(currentDevice.getIDevice());
- }
-
public static boolean isDeviceConnected() {
if (null == devices || devices.isEmpty()) {
return false;
private static IDeviceChangeListener deviceChanged = new IDeviceChangeListener() {
@Override
- public void deviceDisconnected(IDevice device) {
- if (!AnalyzerManager.isRunning()) {
- // called : each device disconnected time
- System.out.println("device disconnected : "
- + device.getSerialNumber());
- DeviceInfo deviceInfo = getDeviceByName(device
- .getSerialNumber());
- if (null != devices && !devices.isEmpty()) {
- devices.remove(deviceInfo);
+ public void onDisconnected(IDevice device) {
+ // called : each device disconnected time
+ System.out.println("device disconnected : "
+ + device.getSerialNumber());
+ DeviceInfo deviceInfo = getDeviceByName(device.getSerialNumber());
+ if (null != devices && !devices.isEmpty()) {
+ devices.remove(deviceInfo);
+ if (!AnalyzerManager.isRunning()) {
checkDevices();
- if (isRunning()) {
- System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
- UIRecorderTool.getInstance().stop();
- DACommunicator.setRunning(false);
- }
+ }
+ if (isRunning()) {
+ System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
+ UIRecorderTool.getInstance().stop();
+ DACommunicator.setRunning(false);
}
}
}
@Override
- public void deviceConnected(IDevice device) {
+ public void onConnected(IDevice device) {
// It called when dynamic-analyzer start, only one time
System.out
.println("device connected : " + device.getSerialNumber());
}
@Override
- public void deviceChanged(IDevice device, int changeMask) {
+ public void onChanged(IDevice device, int changeMask) {
// called : device added - already dynamic-analyzer running (not
// tracing)
- if (!AnalyzerManager.isRunning()) {
- System.out.println("device changed : "
- + device.getSerialNumber() + " " + changeMask);
- if (1 == changeMask) {
- addDevice(device);
+ System.out.println("device changed : " + device.getSerialNumber()
+ + " " + changeMask);
+ if (1 == changeMask) {
+ addDevice(device);
+ if (!AnalyzerManager.isRunning()) {
checkDevices();
- if (null != getSelectedDevice() && null != getSelectedApp()) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- ToolbarArea.getInstance()
- .setStartButtonEnablement(true);
- ToolbarArea.getInstance()
- .setStartButtonEnablement(true);
- }
- });
- }
+ }
+ if (null != getSelectedDevice() && null != getSelectedApp()) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance().setStartButtonEnablement(
+ true);
+ ToolbarArea.getInstance().setStartButtonEnablement(
+ true);
+ }
+ });
}
}
}
}
int size = getDevices().size();
for (int i = 0; i < size; i++) {
- if (serial.equals(devices.get(i).getIDevice().getSerialNumber())) {
- setSelectedDevice(devices.get(i));
+ IDevice idev = devices.get(i).getIDevice();
+ if (null != idev) {
+ if (serial.equals(idev.getSerialNumber())) {
+ setSelectedDevice(devices.get(i));
+ }
}
}
}
public static void pullDaemonLog() {
final String from = AnalyzerPaths.DA_DAEMON_LOG_PATH;
final String to = PathManager.getLogPath() + File.separator
- + "da_daemon_log_" + PathManager.getLogPostFix();//$NON-NLS-1$
- SyncResult res = pull(from, to);
- if (null != res && SyncService.RESULT_OK == res.getCode()) {
+ + AnalyzerConstants.DAEMONLOG_PREFIX
+ + PathManager.getLogPostFix();//$NON-NLS-1$
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && RESULT_OK == res.getCode()) {
System.out.println("daemon log copying success!!");//$NON-NLS-1$
} else {
System.out.println("Failed to get " + from); //$NON-NLS-1$
}
+
+ AnalyzerUtil.checkLogs(PathManager.getLogPath(),
+ AnalyzerConstants.DAEMONLOG_PREFIX,
+ AnalyzerConstants.DAEMONLOG_COUNT);
+ }
+
+ // public static String getLocalhost() {
+ // NetworkInterface ni;
+ // InetAddress i;
+ //
+ // Enumeration<NetworkInterface> ne;
+ // try {
+ // ne = NetworkInterface.getNetworkInterfaces();
+ // } catch (SocketException e1) {
+ // e1.printStackTrace();
+ // return null;
+ // }
+ // while (ne.hasMoreElements()) {
+ // ni = (NetworkInterface) ne.nextElement();
+ // if (ni.getName().contains("lo")) {//$NON-NLS-1$
+ // Enumeration<InetAddress> e = ni.getInetAddresses();
+ // while (e.hasMoreElements()) {
+ // i = (InetAddress) e.nextElement();
+ // if (!i.getHostAddress().contains(CommonConstants.PERCENT)
+ // && !i.getHostAddress().contains(
+ // CommonConstants.COLON)) {
+ // return i.getHostAddress();
+ // }
+ // }
+ // }
+ // }
+ // return null;
+ // }
+
+ public static boolean isWaitControlMessage() {
+ return communicator.isBlocked();
}
- public static String getLocalhost() {
- NetworkInterface ni;
- InetAddress i;
+ public static BufferedReader getSockBufferedReader() {
+ return communicator.getDataBufferedReader();
+ }
- Enumeration<NetworkInterface> ne;
- try {
- ne = NetworkInterface.getNetworkInterfaces();
- } catch (SocketException e1) {
- e1.printStackTrace();
- return null;
- }
- while (ne.hasMoreElements()) {
- ni = (NetworkInterface) ne.nextElement();
- if (ni.getName().contains("lo")) {//$NON-NLS-1$
- Enumeration<InetAddress> e = ni.getInetAddresses();
- while (e.hasMoreElements()) {
- i = (InetAddress) e.nextElement();
- if (!i.getHostAddress().contains(CommonConstants.PERCENT)
- && !i.getHostAddress().contains(
- CommonConstants.COLON)) {
- return i.getHostAddress();
- }
- }
- }
- }
- return null;
+ public static void closeAll() {
+ communicator.clear();
}
- public static boolean isWaitControlMessage() {
- return blocked;
+ public static HostResult handleControlMessage(String msg) {
+ return communicator.handleControlMessage(msg);
+ }
+
+ public static HostResult sendKeepAliveMessage(DeviceInfo device) {
+ return communicator.sendKeepAliveMessage(device);
+ }
+
+ public static Socket getDataSocket() {
+ return communicator.getDataSocket();
+ }
+
+ public static String getTargetVersion() {
+ return currentDevice.getTargetVersion();
+ }
+
+ public static boolean isSWAPVersion() {
+ if (getTargetVersion().contains("3.0")) {
+ return true;
+ } else {
+ return false;
+ }
}
}
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class IDECommunicator implements Runnable {
- private final int MAXBUFSIZE = 1024;
+ private static final int MAXBUFSIZE = 1024;
- private final String IDE_DA_COMMUNICATION_TYPE_1 = "STATUS";//$NON-NLS-1$
- private final String IDE_DA_COMMUNICATION_TYPE_2 = "RUN";//$NON-NLS-1$
- private final static String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE";//$NON-NLS-1$
- private final String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record";//$NON-NLS-1$
- private final String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop";//$NON-NLS-1$
+ private static final String IDE_DA_COMMUNICATION_TYPE_1 = "STATUS";//$NON-NLS-1$
+ private static final String IDE_DA_COMMUNICATION_TYPE_2 = "RUN";//$NON-NLS-1$
+ private static final String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE";//$NON-NLS-1$
+ private static final String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record";//$NON-NLS-1$
+ private static final String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop";//$NON-NLS-1$
// private final int MSG_INDEX_CMD = 0;
- private final int MSG_INDEX_DEVICE = 1;
- private final int MSG_INDEX_APPID = 2;
- private final int MSG_INDEX_APPNAME = 3;
- private final int MSG_LENGTH = 4;
- private final int APPNAME_LENGTH = 20;
+ private static final int MSG_INDEX_DEVICE = 1;
+ private static final int MSG_INDEX_APPID = 2;
+ private static final int MSG_INDEX_APPNAME = 3;
+ private static final int MSG_LENGTH = 4;
+ private static final int APPNAME_LENGTH = 20;
private static Socket socket = null;
private int port = 0;
private static boolean openWelcomeDlg = false;
private static Boolean waitingWelcomeDlg = false;
- DADialog warning = null;
public void run() {
while (true) {
private boolean readActiveIdePort() {
boolean bSuccess = true;
// read port from current_active_ide_port
+ FileInputStream fis = null;
+ DataInputStream dis = null;
try {
File logs = new File(AnalyzerPaths.IDE_ACTIVE_SAVE_PORT_PATH);
if (!logs.exists()) {
bSuccess = false;
}
- FileInputStream fis = new FileInputStream(
- AnalyzerPaths.IDE_ACTIVE_SAVE_PORT_PATH);
- DataInputStream dis = new DataInputStream(fis);
+ fis = new FileInputStream(AnalyzerPaths.IDE_ACTIVE_SAVE_PORT_PATH);
+ dis = new DataInputStream(fis);
try {
port = dis.readInt();
+ if(port < 0){
+ port *= -1;
+ }
} catch (IOException e) {
e.printStackTrace();
bSuccess = false;
} finally {
AnalyzerUtil.tryClose(fis, dis);
+
}
} catch (FileNotFoundException e) {
e.printStackTrace();
bSuccess = false;
+ } finally {
+ AnalyzerUtil.tryClose(fis,dis);
}
return bSuccess;
}
@Override
public void run() {
- MessageProcess.getInstance()
- .run(DACommunicator.getSockBufferedReader());
+ MessageProcess.getInstance().startMessageParsing(
+ DACommunicator.getSockBufferedReader());
}
}
return hash.get(errno).name();\r
}\r
\r
- public String getErrorDescription(String strErr) {\r
- long errno = -1;\r
- try {\r
- errno = Long.parseLong(strErr);\r
- } catch (NumberFormatException e) {\r
- e.printStackTrace();\r
- // errno = -1 and returns null\r
- }\r
+ public String getErrorDescription(long errno) {\r
return hash.get(errno).getMessage();\r
}\r
\r
import org.eclipse.core.commands.ExecutionException;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
IDECommunicator.stopIDEcommunicatorThread();
OpenTraceInputReader.stopOpenTraceInputReader();
LogInserter.stopInsertLogThread();
- DACommunicator
+ CommunicatorUtils
.execCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
DACommunicator.pullDaemonLog();
return null;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;\r
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;\r
import org.tizen.dynamicanalyzer.model.ImageInfo;\r
-import org.tizen.dynamicanalyzer.model.LogCenter;\r
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
import org.tizen.dynamicanalyzer.project.Project;\r
import org.tizen.dynamicanalyzer.resources.ImageResources;\r
import org.tizen.dynamicanalyzer.sql.SqlManager;\r
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;\r
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;\r
+import org.tizen.dynamicanalyzer.swap.model.data.LibraryObject;\r
+import org.tizen.dynamicanalyzer.swap.model.data.ProcessInfo;\r
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;\r
+import org.tizen.dynamicanalyzer.swap.model.probe2.LeakData2;\r
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;\r
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;\r
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;\r
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;\r
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
import org.tizen.dynamicanalyzer.ui.range.RangePage;\r
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;\r
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;\r
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;\r
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;\r
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;\r
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;\r
OpenTraceProgressManager.getInstance().openTracePrgressStart(\r
AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING);\r
int size = pInfo.size();\r
- List<String> logCenterNames = new ArrayList<String>();\r
+ // List<String> logCenterNames = new ArrayList<String>();\r
for (int i = 0; i < size; i++) {\r
if (i == AnalyzerConstants.PROJECT_VERSION_INDEX) {\r
if (!AnalyzerConstants.SAVE_DATA_VERSION.equals(pInfo\r
p.setCreateTime(pInfo.get(i));\r
} else if (i == AnalyzerConstants.PROJECT_APPNAME_INDEX) {\r
p.setAppName(pInfo.get(i));\r
- } else if (i == AnalyzerConstants.PROJECT_PKG_ID_INDEX) {\r
- p.setPkgId(pInfo.get(i));\r
} else if (i == AnalyzerConstants.PROJECT_STOP_TIME_INDEX) {\r
try {\r
long stopTime = Long.parseLong(pInfo.get(i));\r
.split(CommonConstants.CMD_SPLIT_READ);\r
try {\r
p.setLastLogNum(Long.parseLong(splitLastNum[0]),\r
- LogCenterConstants.LOG_RESOURCE);\r
+ AnalyzerConstants.MSG_PROBE_FILE);\r
p.setLastLogNum(Long.parseLong(splitLastNum[1]),\r
- LogCenterConstants.LOG_DEVICE);\r
+ AnalyzerConstants.MSG_DATA_SYSTEM);\r
p.setLastLogNum(Long.parseLong(splitLastNum[2]),\r
- LogCenterConstants.LOG_PROFILING);\r
+ AnalyzerConstants.MSG_DATA_SAMPLE);\r
} catch (NumberFormatException e) {\r
invalidProgress();\r
return null;\r
invalidProgress();\r
return null;\r
}\r
- } else if (i == AnalyzerConstants.PROJECT_TOTAL_SAMPLE_COUNT) {\r
- try {\r
- int totalSampleCount = Integer.parseInt(pInfo.get(i));\r
- p.setTotalProfilingSampleCount(totalSampleCount);\r
- } catch (NumberFormatException e) {\r
- invalidProgress();\r
- return null;\r
- }\r
- } else {\r
- logCenterNames.add(pInfo.get(i));\r
}\r
}\r
\r
}\r
\r
int percent = OpenTraceProgressManager.getInstance().getPercent();\r
- if (p.initLogCenters(logCenterNames) && loadAppInfo()\r
- && loadCallStackData() && loadCallStackApis()\r
+ if (loadInfos() && loadCallStackData() && loadCallStackApis()\r
&& loadProfilingData() && loadProfilingChildData()\r
&& loadLeakData() && loadFailedData() && loadImageSet()) {\r
\r
/* add each part action.. close... open...etc... */\r
\r
/* resource log view action start */\r
- List<LogCenter> logCenters = AnalyzerManager.getLogCenters();\r
- size = logCenters.size();\r
- for (int i = 0; i < size; i++) {\r
- LogCenter center = logCenters.get(i);\r
- int dataSize = SqlManager.getInstance().selectCount(center);\r
- center.setDataSize(dataSize);\r
- }\r
+ // List<LogCenter> logCenters = AnalyzerManager.getLogCenters();\r
+ // List<Integer> ids = LogDataFactory.getLogList();\r
+ // size = ids.size();\r
+ // for (int i = 0; i < size; i++) {\r
+ // LogCenter center = logCenters.get(i);\r
+ // int dataSize = SqlManager.getInstance().selectCount(center);\r
+ // center.setDataSize(dataSize);\r
+ // }\r
\r
if (RangeDataManager.getInstance().isBeingAnalyzed()) {\r
DAPageComposite page = AnalyzerManager.getCurrentPage();\r
if (null == dbInfo) {\r
System.out.println("failed - loadCallStackData");\r
isSuccess = false;\r
- }\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- int seq = Integer.parseInt(pInfo.get(0));\r
- String addrs = pInfo.get(1);\r
- if (null == addrs) {\r
- continue;\r
- }\r
- String[] splitAddrs = addrs.split(CommonConstants.SLASH);\r
- CallStackData csd = new CallStackData(seq);\r
- List<Long> addrList = csd.getAddrs();\r
- int size = splitAddrs.length;\r
- for (int j = 0; j < size; j++) {\r
- long addr = Long.parseLong(splitAddrs[j]);\r
- addrList.add(addr);\r
+ } else {\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> pInfo = dbInfo.get(i);\r
+ int seq = Integer.parseInt(pInfo.get(0));\r
+ String addrs = pInfo.get(1);\r
+ if (null == addrs) {\r
+ continue;\r
+ }\r
+ String[] splitAddrs = addrs.split(CommonConstants.SLASH);\r
+ CallStackData csd = new CallStackData(seq);\r
+ List<Long> addrList = csd.getAddrs();\r
+ int size = splitAddrs.length;\r
+ for (int j = 0; j < size; j++) {\r
+ long addr = Long.parseLong(splitAddrs[j]);\r
+ addrList.add(addr);\r
+ }\r
+ AnalyzerManager.getCallstackManager()\r
+ .getCallStackDataBySeqMap().put(seq, csd);\r
}\r
- AnalyzerManager.getCallstackManager().getCallStackDataBySeqMap()\r
- .put(seq, csd);\r
}\r
return isSuccess;\r
}\r
if (null == dbInfo) {\r
System.out.println("failed - loadCallStackApis");\r
isSuccess = false;\r
- }\r
-\r
- HashMap<Long, CallStackUnit> apiHash = AnalyzerManager\r
- .getCallstackManager().getCallStackApiByAddrMap();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- long addr = Long.parseLong(pInfo.get(0));\r
- String api = pInfo.get(1);\r
- CallStackUnit csa = new CallStackUnit(addr, api);\r
- apiHash.put(addr, csa);\r
+ } else {\r
+ HashMap<Long, CallStackUnit> apiHash = AnalyzerManager\r
+ .getCallstackManager().getCallStackApiByAddrMap();\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> pInfo = dbInfo.get(i);\r
+ long addr = Long.parseLong(pInfo.get(0));\r
+ String api = pInfo.get(1);\r
+ CallStackUnit csa = new CallStackUnit(addr, api);\r
+ apiHash.put(addr, csa);\r
\r
+ }\r
}\r
return isSuccess;\r
}\r
\r
- private boolean loadAppInfo() {\r
+ private boolean loadInfos() {\r
boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance().setloadAppInfo();\r
+ List<List<String>> dbInfo = SqlManager.getInstance().loadTargetInfo();\r
if (null == dbInfo) {\r
- System.out.println("failed - loadAppInfo");\r
+ System.out.println("failed - loadTargetInfo");\r
isSuccess = false;\r
+ } else {\r
+ List<String> info = dbInfo.get(0);\r
+ TargetInfo target = new TargetInfo();\r
+ target.setSystemMemorySize(Long.parseLong(info.get(0)));\r
+ target.setStorageSize(Long.parseLong(info.get(1)));\r
+ target.setBluetoothSupport(Integer.parseInt(info.get(2)));\r
+ target.setGpsSupport(Integer.parseInt(info.get(3)));\r
+ target.setWifiSupport(Integer.parseInt(info.get(4)));\r
+ target.setCameraCount(Integer.parseInt(info.get(5)));\r
+ target.setNetworkType(info.get(6));\r
+ target.setMaxBrightness(Integer.parseInt(info.get(7)));\r
+ target.setCpuCount(Integer.parseInt(info.get(8)));\r
+ AnalyzerManager.getProject().setTargetInfo(target);\r
}\r
- List<String> info = p.getAppInfo();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- info.set(i, pInfo.get(0));\r
+\r
+ dbInfo.clear();\r
+ dbInfo = SqlManager.getInstance().loadProcessInfo();\r
+ if (null == dbInfo) {\r
+ System.out.println("failed - load Process Info");\r
+ isSuccess = false;\r
+ } else {\r
+ List<String> info = dbInfo.get(0);\r
+ ProcessInfo process = new ProcessInfo();\r
+ process.setPid(Integer.parseInt(info.get(0)));\r
+ process.setTime(Long.parseLong(info.get(1)));\r
+ process.setLowestAddress(Long.parseLong(info.get(2)));\r
+ process.setHighestAddress(Long.parseLong(info.get(3)));\r
+ process.setAppType(Integer.parseInt(info.get(4)));\r
+ process.setBinaryType(Integer.parseInt(info.get(5)));\r
+ process.setBinaryPath(info.get(6));\r
+ process.setDepLibCount(Integer.parseInt(info.get(7)));\r
+ AnalyzerManager.getProject().setProcessInfo(process);\r
+ }\r
+\r
+ dbInfo.clear();\r
+ dbInfo = SqlManager.getInstance().loadLibObj();\r
+ if (null == dbInfo) {\r
+ System.out.println("failed - load Lib Object");\r
+ isSuccess = false;\r
+ } else {\r
+ List<LibraryObject> libObjs = AnalyzerManager.getProject()\r
+ .getProcessInfo().getLibObjs();\r
+ for (List<String> info : dbInfo) {\r
+ LibraryObject libObj = new LibraryObject();\r
+ libObj.setLowestAddress(Long.parseLong(info.get(0)));\r
+ libObj.setHighestAddress(Long.parseLong(info.get(1)));\r
+ libObj.setLibPath(info.get(2));\r
+ libObjs.add(libObj);\r
+ }\r
}\r
- return isSuccess;\r
\r
+ dbInfo.clear();\r
+ dbInfo = SqlManager.getInstance().loadApiNames();\r
+ if (null == dbInfo) {\r
+ System.out.println("failed - load Api names");\r
+ isSuccess = false;\r
+ } else {\r
+ List<String> apiList = ApiNameManager.getApiList();\r
+ for (List<String> info : dbInfo) {\r
+ apiList.add(info.get(0));\r
+ }\r
+ }\r
+ return isSuccess;\r
}\r
\r
private boolean loadImageSet() {\r
if (null == dbInfo) {\r
System.out.println("failed - loadLeakData");\r
isSuccess = false;\r
- }\r
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- LeakData leakData = new LeakData(pInfo);\r
- if (null != leakData.getParentKey()\r
- && !leakData.getParentKey().isEmpty()) {\r
- LeakData parent = leakDectector.getLeakHash().get(\r
- leakData.getParentKey());\r
- if (null == parent) {\r
- continue;\r
+ } else {\r
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> pInfo = dbInfo.get(i);\r
+ LeakData2 leakData = new LeakData2(pInfo);\r
+ if (-1 != leakData.getParentKey()) {\r
+ LeakData2 parent = leakDectector.getLeakHash().get(\r
+ leakData.getParentKey());\r
+ if (null == parent) {\r
+ continue;\r
+ } else {\r
+ parent.getChildren().add(leakData);\r
+ }\r
} else {\r
- parent.getChildren().add(leakData);\r
+ leakDectector.getLeakHash()\r
+ .put(leakData.getKey(), leakData);\r
}\r
- } else {\r
- leakDectector.getLeakHash().put(leakData.getKey(), leakData);\r
}\r
}\r
return isSuccess;\r
if (null == dbInfo) {\r
System.out.println("failed - loadFailedData");\r
isSuccess = false;\r
- }\r
-\r
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- // possibility of extensions - network, efl, db, etc...\r
- int id = Integer.parseInt(pInfo.get(LogCenterConstants.ID_INDEX));\r
- if (id == LogCenterConstants.LOG_RESOURCE) {\r
- // if file failed api data is skip - file chart make it!\r
- int type = Integer.parseInt(pInfo\r
- .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));\r
- if (type == LogCenterConstants.FD_TYPE_FILE) {\r
- continue;\r
+ } else {\r
+ FailedChecker failedChecker = AnalyzerManager.getFailedChecker();\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> pInfo = dbInfo.get(i);\r
+ // possibility of extensions - network, efl, db, etc...\r
+ int id = Integer.parseInt(pInfo\r
+ .get(LogCenterConstants.ID_INDEX));\r
+ if (id == AnalyzerConstants.MSG_PROBE_FILE) {\r
+ // if file failed api data is skip - file chart make it!\r
+ int type = Integer.parseInt(pInfo\r
+ .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));\r
+ if (type == LogCenterConstants.FD_TYPE_FILE) {\r
+ continue;\r
+ }\r
}\r
+ FailedData2 failedData = new FailedData2(pInfo);\r
+ failedChecker.getFailedList().add(failedData);\r
}\r
- FailedData failedData = new FailedData(pInfo);\r
- failedChecker.getFailedList().add(failedData);\r
-\r
}\r
return isSuccess;\r
}\r
if (null == dbInfo) {\r
System.out.println("failed - loadProfilingData");\r
isSuccess = false;\r
- }\r
+ } else {\r
\r
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
- .getProfileDataMaker();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- // possibility of extensions - network, efl, db, etc...\r
- ProfilingData fupData = new ProfilingData(pInfo, profiler);\r
- String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);\r
- profiler.getProfilingDataMap().put(seq, fupData);\r
- String symbol = pInfo.get(ProfilingData.KEY_INDEX);\r
- profiler.getSymbolSeqHash().put(symbol, seq);\r
- UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
- .addProfilingData(fupData);\r
- }\r
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
+ .getProfileDataMaker();\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> pInfo = dbInfo.get(i);\r
+ // possibility of extensions - network, efl, db, etc...\r
+ ProfilingData fupData = new ProfilingData(pInfo, profiler);\r
+ String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);\r
+ profiler.getProfilingDataMap().put(Integer.parseInt(seq),\r
+ fupData);\r
+ String symbol = pInfo.get(ProfilingData.KEY_INDEX);\r
+ profiler.getSymbolSeqHash().put(symbol, seq);\r
+ UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
+ .addProfilingData(fupData);\r
+ }\r
\r
- ProfilingData ab = profiler\r
- .getProfilingDataByKey(FunctionUsageProfiler.APPLICATION_KEY);\r
- profiler.setAppBin(ab);\r
- ProfilingData dl = profiler\r
- .getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);\r
- profiler.setDependentLib(dl);\r
+ ProfilingData ab = profiler\r
+ .getProfilingDataByKey(FunctionUsageProfiler.APPLICATION_KEY);\r
+ profiler.setAppBin(ab);\r
+ ProfilingData dl = profiler\r
+ .getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);\r
+ profiler.setDependentLib(dl);\r
\r
+ }\r
return isSuccess;\r
}\r
\r
if (null == dbInfo) {\r
System.out.println("failed - loadProfilingChildData");\r
isSuccess = false;\r
- }\r
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
- .getProfileDataMaker();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> data = dbInfo.get(i);\r
- if (data.size() < 2) {\r
- continue;\r
- }\r
- String seqs = data.get(1);\r
- String[] splitSeqs = seqs.split(CommonConstants.SLASH);\r
- List<String> childData = new ArrayList<String>();\r
- for (int ii = 0; ii < splitSeqs.length; ii++) {\r
- childData.add(new String(splitSeqs[ii]));\r
+ } else {\r
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
+ .getProfileDataMaker();\r
+ for (int i = 0; i < dbInfo.size(); i++) {\r
+ List<String> data = dbInfo.get(i);\r
+ if (data.size() < 2) {\r
+ continue;\r
+ }\r
+ String seqs = data.get(1);\r
+ String[] splitSeqs = seqs.split(CommonConstants.SLASH);\r
+ List<Integer> childData = new ArrayList<Integer>();\r
+ for (int ii = 0; ii < splitSeqs.length; ii++) {\r
+ childData.add(Integer.parseInt(splitSeqs[ii]));\r
+ }\r
+ int key = Integer.parseInt(data.get(0));\r
+ ProfilingData parent = profiler.getProfilingDataMap().get(key);\r
+ ProfilingChildData child = parent.getChildData();\r
+ child.getChildren().addAll(childData);\r
+ profiler.getChildListMap().put(data.get(0), child);\r
}\r
- ProfilingData parent = profiler.getProfilingDataMap().get(\r
- data.get(0));\r
- ProfilingChildData child = parent.getChildData();\r
- child.getChildren().addAll(childData);\r
- profiler.getChildListMap().put(data.get(0), child);\r
}\r
return isSuccess;\r
}\r
IPerspectiveDescriptor perspective) {
ToolbarArea.getInstance().initToolbarEnablement();
- DACommunicator.init();
+ DACommunicator.reload();
DACommunicator.addDeviceListener();
DACommunicator.loadDevices();
DACommunicator.checkDevices();
+ if (DACommunicator.checkVersion().isSuccess()) {
+ DACommunicator.init();
+ } else {
+ System.out.println("invalid version");
+ }
}
@Override
package org.tizen.dynamicanalyzer.listeners;
-import java.util.List;
-
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.graphics.Point;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UIEventData;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
public class SummaryMouseDoubleClickListener implements MouseListener {
boolean doubleClicked = false;
- List<String> data = null;
+ LogData data = null;
String pageId = null;
@Override
return;
}
DATableDataFormat tableData = (DATableDataFormat) item.getData();
- data = tableData.getData();
- String logId = data.get(LogCenterConstants.ID_INDEX);
- int id = Integer.parseInt(logId);
- if (id == LogCenterConstants.LOG_RESOURCE) {
+ data = tableData.getLogData();
+ if (data instanceof FileData) {
// String fdType =
// data.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
// int type = Integer.parseInt(fdType);
// else {
// pageId = NetworkPage.ID;
// }
- } else if (id == LogCenterConstants.LOG_THREAD) {
+ } else if (data instanceof ThreadData) {
pageId = ThreadPage.ID;
- } else if (id == LogCenterConstants.LOG_CONTROL) {
+ } else if (data instanceof UIEventData) {
pageId = UIPage.ID;
} else {
return;
import java.io.FileNotFoundException;\r
import java.io.FileReader;\r
import java.io.IOException;\r
-import java.util.List;\r
\r
import org.eclipse.nebula.widgets.grid.Grid;\r
import org.eclipse.nebula.widgets.grid.GridItem;\r
import org.tizen.dynamicanalyzer.resources.ColorResources;\r
import org.tizen.dynamicanalyzer.resources.FontResources;\r
import org.tizen.dynamicanalyzer.resources.ImageResources;\r
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;\r
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;\r
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;\r
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;\r
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;\r
private SourceLine getSourceLine(GridItem item) {\r
// Gets source path and line.\r
DATableDataFormat tableData = (DATableDataFormat) item.getData();\r
- List<String> data = tableData.getData();\r
- String addr = null;\r
- int id = Integer.parseInt(data.get(LogCenterConstants.ID_INDEX));\r
- if (id == LogCenterConstants.LOG_USER_FUNCTION) {\r
- addr = data.get(LogCenterConstants.CALLER_PCADDR_INDEX);\r
- } else if (id == LogCenterConstants.TYPE_CALLSTACK) {\r
- addr = (String) tableData.getObject();\r
+ LogData data = tableData.getLogData();\r
+ long addr = -1;\r
+ if (tableData.getType() == LogCenterConstants.TYPE_CALLSTACK) {\r
+ addr = (Long) tableData.getObject();\r
+ } else if (data instanceof UserFunctionData) {\r
+ addr = ((UserFunctionData) data).getCallerPcAddr();\r
} else {\r
- String seq = data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);\r
- if (seq == null || seq.isEmpty()) {\r
- SourceLine sl = new SourceLine();\r
- sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
- return sl;\r
- }\r
- int seqNum = -1;\r
- try {\r
- seqNum = Integer.parseInt(seq);\r
- } catch (NumberFormatException e) {\r
- seq = data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);\r
- try {\r
- seqNum = Integer.parseInt(seq);\r
- } catch (NumberFormatException e2) {\r
- // not supported action\r
- SourceLine sl = new SourceLine();\r
- sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
- return sl;\r
- }\r
- }\r
+ int seqNum = data.getSeq();\r
if (seqNum < 0) {\r
SourceLine sl = new SourceLine();\r
sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
addr = AnalyzerManager.getCallstackManager().getPCAddrBySeq(seqNum);\r
}\r
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();\r
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();\r
+ String baseAddr = Long.toString(AnalyzerManager.getProject().getBaseAddress());\r
String path = AnalyzerManager.getProject().getBinaryPath();\r
SourceLine sl = SymbolManager.addr2line(path, addr, isPieBuild,\r
baseAddr);\r
package org.tizen.dynamicanalyzer.logparser;
+
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;;
public class InsertLogQueue {
private static final int FULL_COUNT = 10000;
package org.tizen.dynamicanalyzer.logparser;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+
public class LogCenterConstants {
/* probe IDs */
public static final int LOG_MEMORY = 1;
public static final int LOG_CONTROL = 2;
- public static final int LOG_RECODER = 3;
+ public static final int LOG_UI_EVENT = 3;
public static final int LOG_USER_FUNCTION = 4;
public static final int LOG_RESOURCE = 5;
public static final int LOG_LIFECYCLE = 6;
public static final int FD_TYPE_FILE = 0;
public static final int FD_TYPE_SOCKET = 1;
public static final int FD_TYPE_THREAD = 2;
-
+
/* Log File */
-// public static final int FD_API_TYPE_OPEN = 0;
-// public static final int FD_API_TYPE_CLOSE = 1;
-// public static final int FD_API_TYPE_READ_START = 2;
-// public static final int FD_API_TYPE_READ_END = 3;
-// public static final int FD_API_TYPE_WRITE_START = 4;
-// public static final int FD_API_TYPE_WRITE_END = 5;
-// public static final int FD_API_TYPE_OTHERS = 6;
-
+ // public static final int FD_API_TYPE_OPEN = 0;
+ // public static final int FD_API_TYPE_CLOSE = 1;
+ // public static final int FD_API_TYPE_READ_START = 2;
+ // public static final int FD_API_TYPE_READ_END = 3;
+ // public static final int FD_API_TYPE_WRITE_START = 4;
+ // public static final int FD_API_TYPE_WRITE_END = 5;
+ // public static final int FD_API_TYPE_OTHERS = 6;
+
public static final int FD_API_TYPE_OPEN = 0;
public static final int FD_API_TYPE_CLOSE = 1;
public static final int FD_API_TYPE_READ_START = 2;
public static final int FD_API_TYPE_WRITE_START = 3;
public static final int FD_API_TYPE_WRITE_END = 35;
public static final int FD_API_TYPE_OTHERS = 4;
-
+
/* Log snapshot */
public static final int SNAPSHOT_IMAGE_PATH_INDEX = 12;
public static final int SNAPSHOT_ROTATE_INDEX = 13;
public static final int PROFILING_LOG_PCADDR_INDEX = 3;
public static final int PROFILING_LOG_CALLSTACK_INDEX = 4;
public static final int PROFILING_LOG_RESERVED_INDEX = 5;
-
+
/* thread log : 12 */
public static final int THREAD_PTHREAD_ID_INDEX = 12;
public static final int THREAD_TIZENTHREAD_ID_INDEX = 13;
public static final int CUSTOM_CHART_COLOR = 15;
public static final int CUSTOM_CHART_VALUE = 16;
public static final int CUSTOM_CHART_RESERVED = 17;
-
+
/* synchronization log : 14 */
public static final int SYNC_VAL_INDEX = 12;
public static final int SYNC_TYPE_INDEX = 13;
public static final int SYNC_TYPE_PTHREAD_RWLOCK = 5;
public static final int SYNC_TYPE_PTHREAD_SPINLOCK = 6;
public static final int SYNC_TYPE_PTHREAD_BARRIER = 7;
-
+
public static final int SYNC_API_TYPE_NEW = 0;
public static final int SYNC_API_TYPE_ACQUIRE_WAIT_START = 1;
public static final int SYNC_API_TYPE_ACQUIRE_WAIT_END = 2;
public static final int COMMON_COLUMN_SIZE_ERROR = 0;
public static String getLogCenterNameFromId(int id) {
- if (id == LOG_MEMORY) {
+ if (id == AnalyzerConstants.MSG_PROBE_MEMORY) {
return "memory"; //$NON-NLS-1$
} else if (id == LOG_USER_FUNCTION) {
return "user function"; //$NON-NLS-1$
- } else if (id == LOG_RESOURCE) {
+ } else if (id == AnalyzerConstants.MSG_PROBE_FILE) {
return "resource"; //$NON-NLS-1$
- } else if (id == LOG_THREAD) {
+ } else if (id == AnalyzerConstants.MSG_PROBE_THREAD) {
return "thread"; //$NON-NLS-1$
} else {
return "etc..."; //$NON-NLS-1$
package org.tizen.dynamicanalyzer.logparser;
import java.util.List;
+
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
/** log insert into database **/
public class LogInserter implements Runnable {
@Override
public void run() {
- List<LogCenter> logcs = AnalyzerManager.getLogCenters();
- int size = logcs.size();
+ List<Integer> logIds = LogDataFactory.getLogList();
+ int size = logIds.size();
InsertLogQueue logQueue = getInsertLogQueue();
while (!AnalyzerManager.isExit()) {
try {
break;
}
for (int i = 0; i < size; i++) {
- LogCenter logCenter = logcs.get(i);
- Logs newLogs = new Logs(logCenter.getId());
- Logs logs = logPack.getLogs(logCenter.getId());
+ int logId = logIds.get(i);
+ Logs logs = logPack.getLogs(logId);
if (null != logs) {
+ Logs newLogs = new Logs(logId);
newLogs.getLogs().addAll(logs.getCloneLogs());
getLogPackage().putLogs(logs);
}
} // for
for (int i = 0; i < size; i++) {
- LogCenter logCenter = logcs.get(i);
- Logs logs = getLogPackage().getLogs(logCenter.getId());
+ int logId = logIds.get(i);
+ Logs logs = getLogPackage().getLogs(logId);
if (null != logs) {
- SqlManager.getInstance().insert(logCenter, logs.getLogs());
- int count = logCenter.getDataSize();
- count += logs.getLogs().size();
- logCenter.setDataSize(count);
+ SqlManager.getInstance().insert(logId, logs.getLogs());
}
}
initLogPackage();
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
public class LogListQueue {
- private List<List<List<String>>> data = null;
+ private List<List<LogData>> data = null;
public LogListQueue() {
- data = new ArrayList<List<List<String>>>();
+ data = new ArrayList<List<LogData>>();
}
- public synchronized List<List<String>> getFirst() {
+ public synchronized List<LogData> getFirst() {
while (isEmpty()) {
if (LogParser.isLogParsingComplete()) {
return null;
e.printStackTrace();
}
}
- List<List<String>> output = data.get(0);
+ List<LogData> output = data.get(0);
data.remove(0);
notifyAll();
return output;
}
- public synchronized void putLog(List<List<String>> input) {
+ public synchronized void putLog(List<LogData> input) {
while (isFull()) {
try {
wait();
public boolean isEmpty() {
if (null == data) {
- data = new ArrayList<List<List<String>>>();
+ data = new ArrayList<List<LogData>>();
}
return data.isEmpty();
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.logparser;
+
+import java.util.HashMap;
+import java.util.List;
+
+
+public class LogPackageOld {
+ private HashMap<Integer, LogsOld> logMap;
+
+ public void clear()
+ {
+ getLogMap().clear();
+ }
+
+ public LogPackageOld() {
+ logMap = new HashMap<Integer, LogsOld>();
+ }
+
+ private HashMap<Integer, LogsOld> getLogMap()
+ {
+ if (null == logMap)
+ {
+ logMap = new HashMap<Integer, LogsOld>();
+ }
+ return logMap;
+ }
+ public boolean isEmpty()
+ {
+ return getLogMap().isEmpty();
+ }
+
+ public void setLogs(int id, List<String> input) {
+ LogsOld logs = getLogMap().get(id);
+ if (null == logs)
+ {
+ logs = new LogsOld(id);
+ logMap.put(id, logs);
+ }
+ logs.getLogs().add(input);
+ }
+
+ public void setLogs(int id, LogsOld logs)
+ {
+ if (null != getLogMap().get(id))
+ {
+ logMap.remove(id);
+ }
+ logMap.put(id, logs);
+ }
+
+ public LogsOld getLogs(int id)
+ {
+ return getLogMap().get(id);
+ }
+
+ public void putLogs(LogsOld logs)
+ {
+ if (null != logs)
+ {
+ int id = logs.getId();
+ LogsOld base = getLogMap().get(id);
+ if (null == base)
+ {
+ logMap.put(id, logs);
+ }
+ else
+ {
+ base.getLogs().addAll(logs.getLogs());
+ }
+ }
+ }
+}
*/
package org.tizen.dynamicanalyzer.logparser;
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+
import java.io.File;
-import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.SymbolManager;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.model.ImageInfo;
-import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ScreenShotData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.ImageUtil;
-import org.tizen.sdblib.SyncService;
-import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.service.SyncResult;
public class LogParser implements Runnable {
private final String OSP_MAIN = "OspMain"; //$NON-NLS-1$
- private final String TIME_POST_FIX = "00";//$NON-NLS-1$
private static Thread logParser = null;
private static boolean dropCallTraceLog = false;
private static LogQueue logQueue = null;
private int DEFAULT_IMG_HEIGHT = 800;
/** thread **/
- private String pid = null;
+ private int pid = -1;
public static void clear() {
stopLogParser();
}
}
+ private void checkProbeCommon(String[] input, LogData ld) {
+ ProbeCommonData data = (ProbeCommonData) ld;
+ int iVal = 0;
+ long lVal = 0;
+ String sVal = null;
+ float fVal = 0;
+
+ iVal = data.getApiId();
+ iVal = data.getPid();
+ iVal = data.getTid();
+ sVal = data.getArgs();
+ lVal = data.getReturn();
+ lVal = data.getErrno();
+ iVal = data.getInternalCall();
+ lVal = data.getCallerPcAddr();
+ iVal = data.getReserved1();
+ iVal = data.getReserved2();
+ }
+
+ private void testScreenshotData(String[] input, LogData ld) {
+ ScreenShotData log = (ScreenShotData) ld;
+ int iVal = 0;
+ long lVal = 0;
+ String sVal = null;
+ float fVal = 0;
+
+ checkProbeCommon(input, ld);
+ sVal = log.getImageFilePath();
+ iVal = log.getOrientation();
+ }
+
+ private void testSystemData(String[] input, LogData ld) {
+ SystemData log = (SystemData) ld;
+ int iVal = 0;
+ long lVal = 0;
+ String sVal = null;
+ float fVal = 0;
+
+ iVal = log.getId();
+ iVal = log.getSeq();
+ lVal = log.getTime();
+ iVal = log.getEnergy();
+ iVal = log.getWiFiStatus();
+ iVal = log.getBlutToothStatus();
+ iVal = log.getGPSStatus();
+ iVal = log.getBrightnessStatus();
+ iVal = log.getCameraStatus();
+ iVal = log.getSoundStatus();
+ iVal = log.getAudioStatus();
+ iVal = log.getVibrationStatus();
+ iVal = log.getVoltageStatus();
+ iVal = log.getRSSIStatus();
+ iVal = log.getVideoStatus();
+ iVal = log.getCallStatus();
+ iVal = log.getDNetStatus();
+ sVal = log.getCpuFrequency();
+ fVal = log.getAppCpuUsage();
+ sVal = log.getCpuLoad();
+ iVal = log.getVirtualMemory();
+ iVal = log.getResidentMemory();
+ iVal = log.getSharedMemory();
+ iVal = log.getPSSMemory();
+ iVal = log.getTotalAllocSize();
+ lVal = log.getTotalSystemMemory();
+ lVal = log.getUsedSystemMemory();
+ iVal = log.getTotalUsedDrive();
+ iVal = log.getThreadCount();
+ sVal = log.getThreadLoad();
+ iVal = log.getProcessCount();
+ sVal = log.getProcessLoad();
+ iVal = log.getDISKReadSize();
+ iVal = log.getDISKWriteSize();
+ iVal = log.getNetworkSendSize();
+ iVal = log.getNetworkReceiveSize();
+ }
+
private void logSlicing(List<String> logLumb) {
- String[] slicedLog = null;
+ String[] slicedLog2 = null;
Project project = AnalyzerManager.getProject();
int size = logLumb.size();
- String logId = null;
LogPackage logPack = new LogPackage();
for (int i = 0; i < size; i++) {
if (logLumb.get(i).isEmpty()) {
continue;
}
- String[] log = logLumb.get(i).split(CommonConstants.NEW_LINE);
-
- slicedLog = log[0].split(AnalyzerConstants.DATA_PARSING_TOKEN);
- logId = slicedLog[LogCenterConstants.ID_INDEX];
- int id = Integer.parseInt(logId);
- if (LogCenterConstants.LOG_PROFILING == id) {
- String[] oldSlicedLog = slicedLog;
- slicedLog = new String[oldSlicedLog.length + 1];
- for (int ii = 0; ii < oldSlicedLog.length; ii++) {
- slicedLog[ii] = oldSlicedLog[ii];
- }
- slicedLog[oldSlicedLog.length] = log[1];
- } else if (LogCenterConstants.LOG_DEVICE != id) {
- if (null == pid) {
- pid = slicedLog[LogCenterConstants.PROCESS_ID_INDEX];
+ String[] input = logLumb.get(i).split(CommonConstants.NEW_LINE);
+
+ slicedLog2 = input[0].split(AnalyzerConstants.DATA_PARSING_TOKEN);
+
+ BasicDataMessage message = new BasicDataMessage();
+ message.makeData(slicedLog2);
+ if (message.getId() == AnalyzerConstants.MSG_DATA_SAMPLE) {
+ message.setCallstack(input[1]);
+ }
+ LogData log = LogDataFactory.createInstance(message);
+ int id = log.getId();
+
+ // if (log instanceof SystemData) {
+ // testSystemData(input, log);
+ // } else if (log instanceof ScreenShotData) {
+ // testScreenshotData(input, log);
+ // }
+
+ if (log instanceof ProbeCommonData) {
+ if (-1 == pid) {
+ pid = ((ProbeCommonData) log).getPid();
} else {
- String p = slicedLog[LogCenterConstants.PROCESS_ID_INDEX];
- if (!pid.equals(p)) {
+ int p = ((ProbeCommonData) log).getPid();
+ if (pid != p) {
continue;
}
}
}
- String currentTime = null;
- int timeIndex = LogCenterConstants.TIME_INDEX;
- if (LogCenterConstants.LOG_PROFILING == id) {
- timeIndex = LogCenterConstants.PROFILING_LOG_TIME_INDEX;
- }
- try {
- currentTime = slicedLog[timeIndex];
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- return;
- }
-
- long longTime = Long.parseLong(currentTime);
- long lastTime = longTime - project.getStartTime();
- String modifyedTime = Long.toString(lastTime) + TIME_POST_FIX;
- slicedLog[timeIndex] = modifyedTime;
-
- String seq = slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- long seqNum = Long.parseLong(seq);
+ // ADJUST TIME
+ long longTime = log.getTime();
+ long startTime = project.getStartTime();
- if (id == LogCenterConstants.LOG_USER_FUNCTION) {
- String apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
- if (apiName.isEmpty() || apiName.equals("_end")) { //$NON-NLS-1$
- setFuncName(slicedLog);
+ if (0 == startTime) {
+ startTime = longTime;
+ project.setStartTime(startTime);
+ }
+ long lastTime = longTime - startTime;
+ lastTime *= 100;
+ log.setTime(lastTime);
+
+ int seqNum = log.getSeq();
+ if (log instanceof UserFunctionData) {
+ UserFunctionData ufData = (UserFunctionData) log;
+ String apiName = ufData.getApiName();
+ if (null == apiName || apiName.isEmpty()
+ || apiName.equals("_end")) { //$NON-NLS-1$
+ setFuncName(ufData);
}
if (LogParser.isDrapCallTraceLog()) {
- apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
+ apiName = ufData.getApiName();
if (!apiName.equals(OSP_MAIN)) {
continue;
}
LogParser.setDropCallTraceLog(false);
}
+ long binaryStartAddr = ufData.getLowPc();
+ long binaryEndAddr = ufData.getHighPc();
- String start = slicedLog[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_START_INDEX];
- String end = slicedLog[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_END_INDEX];
- if (!start.isEmpty() && !end.isEmpty()
+ if (binaryStartAddr > 0 && binaryEndAddr > 0
&& !AnalyzerManager.isBinStartEndSet()) {
- AnalyzerManager.setBinaryStartEndAddr(start, end);
+ AnalyzerManager.setBinaryStartEndAddr(binaryStartAddr,
+ binaryEndAddr);
}
if (AnalyzerManager.getCallstackManager().isIrregularUserCall(
- slicedLog)) {
+ ufData)) {
continue;
}
- pushLog(logId, slicedLog, logPack);
+ pushLog(log, logPack);
/* user callstack create by entry and exit */
AnalyzerManager.getCallstackManager().makeUserCallstack(
- slicedLog,
+ ufData,
FunctionUsageProfiler.getInstance()
.getProfileDataMaker());
- } else if (id == LogCenterConstants.LOG_DEVICE) {
+ } else if (log instanceof SystemData) {
if (seqNum == 1) {
UIRecorderPlayThread rp = UIRecorderTool.getInstance()
.getPlayThead();
UIRecorderTool.getInstance().getPlayThead().interrupt();
}
}
- pushLog(logId, slicedLog, logPack);
- } else if (id == LogCenterConstants.LOG_PROFILING) {
- pushLog(logId, slicedLog, logPack);
+ pushLog(log, logPack);
+ } else if (log instanceof ProfileData) {
+ pushLog(log, logPack);
} else {
- if (id == LogCenterConstants.LOG_SCREENSHOT) {
- String remoteImgPath = new String(
- slicedLog[LogCenterConstants.SNAPSHOT_IMAGE_PATH_INDEX]);
- String rotate = new String(
- slicedLog[LogCenterConstants.SNAPSHOT_ROTATE_INDEX]);
- processImage(remoteImgPath, rotate);
+ if (log instanceof ScreenShotData) {
+ String remoteImgPath = ((ScreenShotData) log)
+ .getImageFilePath();
+ String rotate = Integer.toString(((ScreenShotData) log)
+ .getOrientation());
+ // TODO : fix
+ // processImage(remoteImgPath, rotate);
}
- pushLog(logId, slicedLog, logPack);
+ pushLog(log, logPack);
AnalyzerManager.getCallstackManager()
- .makeCallstackWithoutBacktrace(slicedLog);
- if (id == LogCenterConstants.LOG_RESOURCE
- || id == LogCenterConstants.LOG_MEMORY) {
- AnalyzerManager.getLeakDetector().runLeakDectect(slicedLog);
+ .makeCallstackWithoutBacktrace(log);
+ if (id == AnalyzerConstants.MSG_PROBE_FILE
+ || id == AnalyzerConstants.MSG_PROBE_MEMORY) {
+ AnalyzerManager.getLeakDetector().runLeakDectect(log);
}
- AnalyzerManager.getFailedChecker().check(slicedLog,
+ AnalyzerManager.getFailedChecker().check(log,
AnalyzerManager.getCallstackManager());
}
@Override
public void run() {
while (true && count < 5) {
- SyncResult res = DACommunicator.pull(from, to);
- if (null != res && SyncService.RESULT_OK == res.getCode()) {
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && RESULT_OK == res.getCode()) {
DACommunicator.removeCommand(from);
/* image resizing */
String smallImagePath = AnalyzerManager.getProject()
bv.getMainTab().updateLog(logPack);
}
- private void setFuncName(String[] input) {
+ private void setFuncName(UserFunctionData input) {
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
String path = AnalyzerManager.getProject().getBinaryPath();
- String pcAddr = input[LogCenterConstants.PCADDR_INDEX];
+ String pcAddr = Long.toString(input.getPCAddress());
String functionName = SymbolManager.addr2func(path, pcAddr, isPieBuild,
baseAddr);
if (null == functionName || functionName.isEmpty()
|| functionName.equals("_end")) { //$NON-NLS-1$
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+ ApiNameManager.getApiId(functionName);
} else {
String prevFunctionName = functionName;
functionName = SymbolManager
.demanglingFunctionName(prevFunctionName);
+ ApiNameManager.getApiId(functionName);
}
- input[LogCenterConstants.APINAME_INDEX] = functionName;
+ input.setApiName(functionName);
}
- private void pushLog(String logId, String[] slicedLog, LogPackage logPack) {
-
- int id = -1;
- try {
- id = Integer.parseInt(logId);
- } catch (NumberFormatException e) {
- /* log for debug */
- e.printStackTrace();
- return;
- }
- if (id < 0) {
- return;
- }
-
- List<String> input = new ArrayList<String>();
- LogCenter logc = AnalyzerManager.getLogCenterById(id);
- if (null == logc) {
- return;
- }
-
- int count = logc.getTotalColumnCount();
- int length = slicedLog.length;
- for (int i = 0; i < count; i++) {
- if (i < length && i < count) {
- input.add(slicedLog[i]);
- } else {
- input.add(CommonConstants.EMPTY);
- }
- }
-
- if (id == LogCenterConstants.LOG_SCREENSHOT) {
+ private void pushLog(LogData log, LogPackage logPack) {
+ if (log instanceof ScreenShotData) {
ImageInfo imgInfo = new ImageInfo();
- imgInfo.setSeq(input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- imgInfo.setTime(input.get(LogCenterConstants.TIME_INDEX));
+ imgInfo.setSeq(Integer.toString(log.getSeq()));
+ imgInfo.setTime(Long.toString(log.getTime()));
AnalyzerManager.getImageSet().put(imgInfo.getSeq(), imgInfo);
}
- logPack.setLogs(id, input);
+ logPack.setLogs(log.getId(), log);
}
}
}
}
- if (null == data) {
- data = new ArrayList<List<String>>();
- }
data.add(input);
notifyAll();
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.logparser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LogsOld {
+ private List<List<String>> logs;
+ int logCenterId;
+
+ public LogsOld(int id) {
+ logs = new ArrayList<List<String>>();
+ logCenterId = id;
+ }
+
+ public int getId() {
+ return logCenterId;
+ }
+
+ // getLogs -> getRawLogs
+ public List<List<String>> getLogs() {
+ if (null == logs) {
+ logs = new ArrayList<List<String>>();
+ }
+ return logs;
+ }
+
+ public void setLogs(List<List<String>> input) {
+ logs = input;
+ }
+
+ public void setLogCenterId(int id) {
+ logCenterId = id;
+ }
+
+ // cloneLogs -> getLogs
+ public List<List<String>> getCloneLogs() {
+ List<List<String>> newLogs = new ArrayList<List<String>>();
+ int size = logs.size();
+ for (int i = 0; i < size; i++) {
+ List<String> newLog = new ArrayList<String>();
+ newLog.addAll(logs.get(i));
+ newLogs.add(newLog);
+ }
+ return newLogs;
+ }
+}
*/
package org.tizen.dynamicanalyzer.logparser;
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.StopHandler;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
+import org.tizen.dynamicanalyzer.swap.model.data.ProcessInfo;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.uirecorder.RecordingQueue;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderRecordThread;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.sdblib.SyncService;
-import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.service.SyncResult;
public class MessageProcess {
public void processMessage(String message) {
// DO NOT DELETE : for debugging
-// System.out.println("count " + messageCount + ": " + message);
+ // System.out.println("count " + messageCount + ": " + message);
try {
String[] messages = message.split(CommonConstants.CMD_SPLIT_READ,
MSG_SPLIT_SIZE);
}
private void processAppInfo(String message) {
- String[] datas = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
- List<String> appInfo = AnalyzerManager.getProject().getAppInfo();
- int size = datas.length;
- for (int i = 0; i < size; i++) {
- appInfo.set(i, new String(datas[i]));
- }
-
- if (size - 1 < AnalyzerConstants.APP_INFO_BINARY_PATH
- || null == appInfo.get(AnalyzerConstants.APP_INFO_BINARY_PATH)
- || appInfo.get(AnalyzerConstants.APP_INFO_BINARY_PATH)
- .isEmpty()) {
+ String[] data = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
+
+ Project project = AnalyzerManager.getProject();
+ TargetInfo tInfo = project.getTargetInfo();
+ ProcessInfo pInfo = project.getProcessInfo();
+
+ tInfo.setSystemMemorySize(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE]));
+ tInfo.setStorageSize(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_STORAGE_SIZE]));
+ tInfo.setBluetoothSupport(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_BLUETOOTH_SUPPORT]));
+ tInfo.setGpsSupport(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_GPS_SUPPORT]));
+ tInfo.setWifiSupport(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_WIFI_SUPPORT]));
+ tInfo.setCameraCount(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_CAMERA_COUNT]));
+ tInfo.setNetworkType(data[AnalyzerConstants.APP_INFO_NETWORK_TYPE]);
+ tInfo.setMaxBrightness(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_MAX_BRIGHTNESS]));
+
+ pInfo.setPid(Integer.parseInt(data[AnalyzerConstants.APP_INFO_PID]));
+// pInfo.setTime(Integer
+// .parseInt(data[AnalyzerConstants.APP_INFO_START_TIME]) * 100);
+ pInfo.setBinaryType(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_PIE_BUILD]));
+ pInfo.setLowestAddress(Long
+ .parseLong(data[AnalyzerConstants.APP_INFO_BASE_ADDRESS]));
+ pInfo.setAppType(Integer
+ .parseInt(data[AnalyzerConstants.APP_INFO_APP_TYPE]));
+ pInfo.setBinaryPath(data[AnalyzerConstants.APP_INFO_BINARY_PATH]);
+
+ if (null == pInfo.getBinaryPath() || pInfo.getBinaryPath().isEmpty()) {
ToolbarArea.getInstance().setSourceViewEnable(false);
ToolbarArea.getInstance().setSourceViewTooltip(
AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
}
// User Call Trace : App is Tizen C++ or Tizen native
- int type = Integer.parseInt(appInfo
- .get(AnalyzerConstants.APP_INFO_APP_TYPE));
- if (type == AnalyzerConstants.APP_TYPE_OSP) {
+ if (pInfo.getAppType() == AnalyzerConstants.APP_TYPE_OSP) {
LogParser.setDropCallTraceLog(true);
}
}
new Thread(null, new Runnable() {
@Override
public void run() {
- SyncResult res = DACommunicator.pull(from, to);
- if (null != res && SyncService.RESULT_OK == res.getCode()) {
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && RESULT_OK == res.getCode()) {
DACommunicator.removeCommand(from);
} else {
System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
private int sentenceIndex = -1;
private String sentence = null;
- public void run(BufferedReader bufferedReader) {
+ public void startMessageParsing(BufferedReader bufferedReader) {
startTimer();
sentenceIndex = -1;
}
- if (AnalyzerConstants.MSG_LOG == index
+ // image log parsing
+ if (AnalyzerConstants.MSG_DEVICE_LOG == index
+ && sentence != null) {
+ processMessage(sentence);
+ sentence = null;
+ sentenceIndex = -1;
+ } else if (AnalyzerConstants.MSG_LOG == index
|| AnalyzerConstants.MSG_USER_PROFILING_SAMPLE == index) {
sentenceIndex = AnalyzerConstants.MSG_LOG;
if (null != sentence) {
addBufferToList();
System.out.println("stop log process start");//$NON-NLS-1$
StopLogProcessor.runStopLogProcessThread();
- DACommunicator.closeSocket();
- DACommunicator.unfoward(DACommunicator.LOCAL_PORT,
- DACommunicator.getRemotePort());
-
+ // DACommunicator.closeSocket();
+ // DACommunicator.unfoward(DACommunicator.LOCAL_PORT,
+ // DACommunicator.getRemotePort());
+ DACommunicator.closeAll();
AnalyzerUtil.executeCommand(StopHandler.ID);
}
}
package org.tizen.dynamicanalyzer.model;
-import java.util.List;
-
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
public class DAView extends Composite implements ViewAction {
}
@Override
- public void setSelection(List<String> data) {
+ public void setSelection(LogData data) {
// TODO Auto-generated method stub
}
package org.tizen.dynamicanalyzer.model;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.Socket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
import org.tizen.sdblib.IDevice;
public class DeviceInfo {
private IDevice device;
private String selectedApplication;
+ private String targetVersion = null;
private List<AppInfo> appInfoList = null;
private HashMap<String, AppInfo> appInfoHash = null;
+ TargetInfo targetInfo = null;
+
+ /*** for version 3.0 */
+ private int remotePort = -1;
+ private Socket controlSock = null;
+ private BufferedWriter controlWriter = null;
+ private BufferedReader controlReader = null;
+
+ private Socket dataSock = null;
+ private BufferedWriter dataWriter = null;
+ private BufferedReader dataReader = null;
+
public DeviceInfo(IDevice device) {
this.device = device;
appInfoList = new ArrayList<AppInfo>();
appInfoHash = new HashMap<String, AppInfo>();
+ targetInfo = new TargetInfo();
}
public void setSelectedAppName(String name) {
public HashMap<String, AppInfo> getAppInfoHash() {
return appInfoHash;
}
+
+ public void setTargetVersion(String version) {
+ targetVersion = version;
+ }
+
+ public String getTargetVersion() {
+ return targetVersion;
+ }
+
+ /*** for version 3.0 */
+ public void setRemotePort(int port) {
+ remotePort = port;
+ }
+
+ public int getRemotePort() {
+ return remotePort;
+ }
+
+ public Socket getDataSock() {
+ return dataSock;
+ }
+
+ public void setDataSock(Socket dataSock) {
+ this.dataSock = dataSock;
+ this.dataSock = dataSock;
+ try {
+ dataReader = new BufferedReader(new InputStreamReader(
+ dataSock.getInputStream()));
+ dataWriter = new BufferedWriter(new OutputStreamWriter(
+ dataSock.getOutputStream()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public BufferedWriter getDataWriter() {
+ return dataWriter;
+ }
+
+ public BufferedReader getDataReader() {
+ return dataReader;
+ }
+
+ public Socket getControlSock() {
+ return controlSock;
+ }
+
+ public void setControlSock(Socket controlSock) {
+ this.controlSock = controlSock;
+ try {
+
+ BufferedInputStream bis = new BufferedInputStream(
+ controlSock.getInputStream());
+ byte[] buffer = new byte[bis.available()];
+ bis.read(buffer);
+ DataInputStream di = new DataInputStream(bis);
+ di.readInt();
+ BufferedOutputStream bos = new BufferedOutputStream(
+ controlSock.getOutputStream());
+ DataOutputStream dout = new DataOutputStream(bos);
+ // dout.write(b)
+
+ controlReader = new BufferedReader(new InputStreamReader(
+ controlSock.getInputStream()));
+ controlWriter = new BufferedWriter(new OutputStreamWriter(
+ controlSock.getOutputStream()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public BufferedWriter getControlWriter() {
+ return controlWriter;
+ }
+
+ public BufferedReader getControlReader() {
+ return controlReader;
+ }
+
+ public boolean equals(DeviceInfo target) {
+ if (device.getSerialNumber().equals(
+ target.getIDevice().getSerialNumber())) {
+ return true;
+ }
+ return false;
+ }
+
+ public void setTargetInfo(TargetInfo info) {
+ targetInfo = info;
+ }
+
+ public TargetInfo getTargetInfo() {
+ return targetInfo;
+ }
}
dataSize = size;
}
- public String getInsertQuery() {
- if (null == insertQuery) {
- insertQuery = SqlManager.getInstance().createInsertQuery(this);
- }
- return insertQuery;
- }
-
public String getSelectCountQuery() {
if (null == selectCountQuery) {
StringBuffer query = new StringBuffer();
public static String OPEN;
public static String CLOSE;
- // Toolbar button
+ // Toolbar button tooltip
public static String START_TRACE;
public static String STOP_TRACE;
public static String SAVE_TRACE;
public static String OPEN_TRACE;
public static String OPEN_TRACE_TITLE;
public static String REPLAY;
-
+
+ // Toolbar button tooltip for mac
public static String START_TRACE_MAC;
public static String STOP_TRACE_MAC;
public static String SAVE_TRACE_MAC;
public static String OPEN_TRACE_MAC;
public static String REPLAY_MAC;
-
+
public static String RANGE_PAGE;
- public static String VIEW_SOURCE;
public static String SNAPSHOT_ENABLE;
- public static String SETTING;
- // setting menu
+ // tooltip text
public static String ABOUT;
+ public static String SETTING;
+ public static String VIEW_SOURCE;
+
+ // tooltip text for mac
+ public static String ABOUT_MAC;
+ public static String SETTING_MAC;
+ public static String VIEW_SOURCE_MAC;
+
+ // popup window title text
+ public static String ABOUT_TITLE;
public static String LICENSE;
public static String CONFIGURATION;
public static String WELCOME;
public static String COOLBAR_AREA_UI;
public static String COOLBAR_AREA_TIMELINE;
public static String COOLBAR_AREA_RANGE;
-
+
public static String COOLBAR_AREA_FILE_TOOLTIP;
public static String COOLBAR_AREA_SUMMARY_TOOLTIP;
public static String COOLBAR_AREA_THREAD_TOOLTIP;
public static String COOLBAR_AREA_UI_TOOLTIP;
public static String COOLBAR_AREA_TIMELINE_TOOLTIP;
public static String COOLBAR_AREA_RANGE_TOOLTIP;
-
+
public static String COOLBAR_AREA_FILE_TOOLTIP_MAC;
public static String COOLBAR_AREA_SUMMARY_TOOLTIP_MAC;
public static String COOLBAR_AREA_THREAD_TOOLTIP_MAC;
public static String COOLBAR_AREA_UI_TOOLTIP_MAC;
public static String COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
public static String COOLBAR_AREA_RANGE_TOOLTIP_MAC;
-
+
public static String COOLBAR_AREA_CONFIGURATION_FEATURES;
public static String COOLBAR_AREA_CONFIGURATION_SETTING;
REPLAY_MAC=Replay [Command + P]
RANGE_PAGE=Range page
-VIEW_SOURCE=View source [F3]
SNAPSHOT_ENABLE=Take snapshot
-SETTING=Settings [F2]
#Setting menu
ABOUT=About Tizen Dynamic Analyzer [F1]
+SETTING=Settings [F2]
+VIEW_SOURCE=View source [F3]
+
+ABOUT_MAC=About Tizen Dynamic Analyzer [fn + F1]
+SETTING_MAC=Settings [fn + F2]
+VIEW_SOURCE_MAC=View source [fn + F3]
+
+#ABOUT_MAC=About Tizen Dynamic Analyzel;
+
+ABOUT_TITLE=About Tizen Dynamic Analyzer
LICENSE=License
CONFIGURATION=Configuration
WELCOME=Welcome
public static String LEAK_TABLE_ETC;
public static String LEAK_TABLE_MEMORY;
- public static String LEAK_TABLE_RESOURCE;
+ public static String LEAK_TABLE_FILE;
public static String LEAK_VIEW_TITLE_LEAK_CANDIDATE;
public static String LEAK_VIEW_TITLE_LEAK;
LEAK_TABLE_ETC=Other
LEAK_TABLE_MEMORY=Memory
-LEAK_TABLE_RESOURCE=Resource
+LEAK_TABLE_FILE=Resource
LEAK_VIEW_TITLE_LEAK_CANDIDATE=Leak candidates
LEAK_VIEW_TITLE_LEAK=Leaks
public static String CALL_TRACE_VIEW_TID;
public static String CALL_TRACE_VIEW_TITLE;
+ public static String UI_EVENT_LIST_TYPE;
public static String UI_EVENT_LIST_NAME;
public static String UI_EVENT_LIST_TIME;
public static String UI_EVENT_LIST_SET_RANGE;
CALL_TRACE_VIEW_TID=Thread id
CALL_TRACE_VIEW_TITLE=Call Trace
-UI_EVENT_LIST_NAME=Event name
+UI_EVENT_LIST_TYPE=Type
+UI_EVENT_LIST_NAME=Name
UI_EVENT_LIST_TIME=Time
UI_EVENT_LIST_SET_RANGE=Set range
\ No newline at end of file
import java.io.File;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.model.BaseLogCenter;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
+import org.tizen.dynamicanalyzer.swap.model.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
public class Project {
+ public static final String TABLE_NAME = "project";
+
+ public static final String APP_NAME = "AppName";
+ public static final String CREATE_TIME = "CreateTime";
+ public static final String SAVE_PATH = "SavePath";
+ public static final String LOG_NUMS = "LastLogs";
+ public static final String SAVE_VERSION = "Version";
+ public static final String DEVICE = "Device";
+ public static final String LAST_TIME = "LastTime";
+ public static final String STOP_TIME = "StopTime";
+
+ // public static final int COLUMN_SIZE = 8;
+
private final static int MAX_FILENAME_LENGTH = 50;
private final String DEFAULT_TIME_FORMAT = "_yyyy-MM-dd-HH-mm-ss";//$NON-NLS-1$
- private final String PIE_BUILD_FLAG = "1";//$NON-NLS-1$
private String appName = null;
private String pkgId = null;
private String createTime = null;
- private List<LogCenter> logCenters;
private String savePath;
private long lastLogNum = 0;
private long lastDeviceLogNum = 0;
private long lastProfileLogNum = 0;
private String version = null;
private String device = null;
- private List<String> appInfo = null;
- private long startTime = 0;
private long lastTime = 0;
- private int systemMemorySize = 0;
- private int pid = 0;
private long stopTime = -1;
- public String getMaxBrightness() {
- if (!getAppInfo().isEmpty()) {
- String size = appInfo
- .get(AnalyzerConstants.APP_INFO_MAX_BRIGHTNESS);
- return size;
- }
- return null;
+ private TargetInfo targetInfo = new TargetInfo();
+ private ProcessInfo processInfo = new ProcessInfo();
+
+ public TargetInfo getTargetInfo() {
+ return targetInfo;
+ }
+
+ public void setTargetInfo(TargetInfo targetInfo) {
+ this.targetInfo = targetInfo;
+ }
+
+ public ProcessInfo getProcessInfo() {
+ return processInfo;
+ }
+
+ public void setProcessInfo(ProcessInfo processInfo) {
+ this.processInfo = processInfo;
+ }
+
+ public void setCoreCount(int count) {
+ targetInfo.setCpuCount(count);
+ }
+
+ public int getCoreCount() {
+ return targetInfo.getCpuCount();
+ }
+
+ public int getMaxBrightness() {
+ return targetInfo.getMaxBrightness();
}
public long getStartTime() {
- if (0 == startTime) {
- if (!getAppInfo().isEmpty()) {
- String time = appInfo
- .get(AnalyzerConstants.APP_INFO_START_TIME);
- if (time.isEmpty()) {
- System.out.println("ERROR : start time is empty!!"); //$NON-NLS-1$
- } else {
- startTime = Long.parseLong(time);
- }
- }
- }
- return startTime;
- }
-
- public int getSystemMemorySize() {
- if (0 == systemMemorySize) {
- if (!getAppInfo().isEmpty()) {
- String time = appInfo
- .get(AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE);
- if (!time.isEmpty()) {
- systemMemorySize = Integer.parseInt(time);
- } else {
- systemMemorySize = 0;
- }
- }
- }
- return systemMemorySize;
+ return processInfo.getTime();
+ }
+
+ public void setStartTime(long time) {
+ processInfo.setTime(time);
+ }
+
+ public long getSystemMemorySize() {
+ return targetInfo.getSystemMemorySize();
}
public int getPID() {
- if (0 == pid) {
- if (!getAppInfo().isEmpty()) {
- String pID = appInfo.get(AnalyzerConstants.APP_INFO_PID);
- pid = Integer.parseInt(pID);
- }
- }
- return pid;
+ return processInfo.getPid();
}
public long getLastTime() {
this.lastTime = lastTime;
}
- public List<String> getAppInfo() {
- if (null == appInfo) {
- appInfo = new ArrayList<String>();
- for (int i = 0; i < AnalyzerConstants.APP_INFO_SIZE; i++) {
- appInfo.add(""); //$NON-NLS-1$
- }
- }
- return appInfo;
- }
-
public void setVersion(String ver) {
version = ver;
}
}
public long getLastLogNum(int type) {
- if (type == LogCenterConstants.LOG_DEVICE) {
+ if (type == AnalyzerConstants.MSG_DATA_SYSTEM) {
return lastDeviceLogNum;
- } else if (type == LogCenterConstants.LOG_PROFILING) {
+ } else if (type == AnalyzerConstants.MSG_DATA_SAMPLE) {
return lastProfileLogNum;
} else {
return lastLogNum;
}
public void setLastLogNum(long last, int type) {
- if (type == LogCenterConstants.LOG_DEVICE) {
+ if (type == AnalyzerConstants.MSG_DATA_SYSTEM) {
if (last > lastDeviceLogNum) {
lastDeviceLogNum = last;
}
- } else if (type == LogCenterConstants.LOG_PROFILING) {
+ } else if (type == AnalyzerConstants.MSG_DATA_SAMPLE) {
if (last > lastProfileLogNum) {
lastProfileLogNum = last;
}
samallImage.mkdirs();
}
- initLogCenters(null);
+ // initLogCenters(null);
AnalyzerManager.setProject(this);
// create table
SqlManager.getInstance().createProjectTable(this);
- int size = getLogCenters().size();
+ List<Integer> ids = LogDataFactory.getLogList();
+ int size = ids.size();
for (int i = 0; i < size; i++) {
if (AnalyzerManager.isExit()) {
return;
}
- SqlManager.getInstance().createTable(logCenters.get(i));
+ SqlManager.getInstance().createTable(ids.get(i));
}
// create save tables
SqlManager.getInstance().createTables();
this.pkgId = pkgId;
}
- public boolean initLogCenters(List<String> names) {
- if (null != logCenters) {
- logCenters = null;
- }
-
- logCenters = new ArrayList<LogCenter>();
- List<LogCenter> baseLogcs = AnalyzerManager.getInnerLogCenters();
- if (null == baseLogcs || baseLogcs.isEmpty()) {
- System.out
- .println("DynamicAnalyzer folder or logc file is missing! "); //$NON-NLS-1$
- return false;
- }
- if (null == names || names.isEmpty()) {
- int size = baseLogcs.size();
- for (int i = 0; i < size; i++) {
- logCenters.add(copyLogCenter(baseLogcs.get(i)));
- }
- return true;
- }
-
- int size = names.size();
- int baseSize = baseLogcs.size();
- for (int i = 0; i < size; i++) {
- for (int a = 0; a < baseSize; a++) {
- if (names.get(i).equals(baseLogcs.get(a).getName())) {
- logCenters.add(copyLogCenter(baseLogcs.get(a)));
- }
- }
- }
- return true;
- }
-
- private LogCenter copyLogCenter(BaseLogCenter from) {
- LogCenter to = new LogCenter();
- to.setId(from.getId());
- to.setName(from.getName());
- to.setTotalColumnCount(from.getTotalColumnCount());
- to.setCustomColumn(from.isCustomColumn());
-
- to.getColumnName().addAll(from.getColumnName());
- to.getType().addAll(from.getType());
- to.getColumnSizes().addAll(from.getColumnSize());
- to.getColumnOrder().addAll(from.getColumnOrder());
- to.getColumnVisibility().addAll(from.getColumnVisibility());
- to.getTableColumnName().addAll(from.getTableColumnName());
- return to;
- }
-
- public List<LogCenter> getLogCenters() {
- return logCenters;
- }
+ // public boolean initLogCenters(List<String> names) {
+ // if (null != logCenters) {
+ // logCenters = null;
+ // }
+ //
+ // logCenters = new ArrayList<LogCenter>();
+ // List<LogCenter> baseLogcs = AnalyzerManager.getInnerLogCenters();
+ // if (null == baseLogcs || baseLogcs.isEmpty()) {
+ // System.out
+ // .println("DynamicAnalyzer folder or logc file is missing! "); //$NON-NLS-1$
+ // return false;
+ // }
+ // if (null == names || names.isEmpty()) {
+ // int size = baseLogcs.size();
+ // for (int i = 0; i < size; i++) {
+ // logCenters.add(copyLogCenter(baseLogcs.get(i)));
+ // }
+ // return true;
+ // }
+ //
+ // int size = names.size();
+ // int baseSize = baseLogcs.size();
+ // for (int i = 0; i < size; i++) {
+ // for (int a = 0; a < baseSize; a++) {
+ // if (names.get(i).equals(baseLogcs.get(a).getName())) {
+ // logCenters.add(copyLogCenter(baseLogcs.get(a)));
+ // }
+ // }
+ // }
+ // return true;
+ // }
+
+ // private LogCenter copyLogCenter(BaseLogCenter from) {
+ // LogCenter to = new LogCenter();
+ // to.setId(from.getId());
+ // to.setName(from.getName());
+ // to.setTotalColumnCount(from.getTotalColumnCount());
+ // to.setCustomColumn(from.isCustomColumn());
+ //
+ // to.getColumnName().addAll(from.getColumnName());
+ // to.getType().addAll(from.getType());
+ // to.getColumnSizes().addAll(from.getColumnSize());
+ // to.getColumnOrder().addAll(from.getColumnOrder());
+ // to.getColumnVisibility().addAll(from.getColumnVisibility());
+ // to.getTableColumnName().addAll(from.getTableColumnName());
+ // return to;
+ // }
public boolean isValid() {
if (null == version || null == appName || null == pkgId
- || null == device || null == logCenters || logCenters.isEmpty()) {
+ || null == device) {
return false;
}
return true;
}
public String getBinaryPath() {
- if (!getAppInfo().isEmpty()) {
- return appInfo.get(AnalyzerConstants.APP_INFO_BINARY_PATH);
- }
- return null;
+ return processInfo.getBinaryPath();
}
public boolean isPieBuild() {
- if (null == appInfo.get(AnalyzerConstants.APP_INFO_PIE_BUILD)) {
- return false;
- } else if (PIE_BUILD_FLAG.equals(appInfo
- .get(AnalyzerConstants.APP_INFO_PIE_BUILD))) { //$NON-NLS-1$
+ if (processInfo.getBinaryType() == 1) {
return true;
}
return false;
}
- public String getBaseAddress() {
- if (!getAppInfo().isEmpty()) {
- return appInfo.get(AnalyzerConstants.APP_INFO_BASE_ADDRESS);
- }
- return null;
+ public long getBaseAddress() {
+ return processInfo.getLowestAddress();
}
public int getApplicationType() {
- if (!getAppInfo().isEmpty()) {
- String appType = appInfo.get(AnalyzerConstants.APP_INFO_APP_TYPE);
- return Integer.parseInt(appType);
- }
- return AnalyzerConstants.APP_TYPE_TIZEN;
+ return processInfo.getAppType();
}
public void setTotalProfilingSampleCount(int count) {
public static String COOLBAR_AREA_TIMELINE_TOOLTIP = null;
public static String COOLBAR_AREA_RANGE_TOOLTIP = null;
+ public static String COOLBAR_AREA_ABOUT = null;
+ public static String COOLBAR_AREA_SETTING = null;
+ public static String COOLBAR_AREA_VIEW_SOURCE = null;
+
static {
if (AnalyzerUtil.isMac()) {
START_TRACE = AnalyzerLabels.START_TRACE_MAC;
COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP_MAC;
COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+
+ COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT_MAC;
+ COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING_MAC;
+ COOLBAR_AREA_VIEW_SOURCE = AnalyzerLabels.VIEW_SOURCE_MAC;
} else {
START_TRACE = AnalyzerLabels.START_TRACE;
STOP_TRACE = AnalyzerLabels.STOP_TRACE;
COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP;
COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP;
COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP;
+
+ COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT;
+ COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING;
+ COOLBAR_AREA_VIEW_SOURCE = AnalyzerLabels.VIEW_SOURCE;
}
}
public static DBTableManager instance = null;
- private final String TABLE_NAME_APP_INFO = "AppInfo";//$NON-NLS-1$
- private final String TABLE_NAME_CALLSTACK_UNITS = "CallstackUnits";//$NON-NLS-1$
- private final String TABLE_NAME_CALLSTACK_DATA = "CallstackData";//$NON-NLS-1$
- private final String TABLE_NAME_FAILED_DATA = "FailedData";//$NON-NLS-1$
- private final String TABLE_NAME_LEAK_DATA = "LeakData";//$NON-NLS-1$
- private final String TABLE_NAME_PROFILING_DATA = "ProfilingData";//$NON-NLS-1$
- private final String TABLE_NAME_PROFILING_CHILD_DATA = "ProfilingChildData";//$NON-NLS-1$
+ public static final String COLUMN_ROWID = "rid";
+ public static final String COLUMN_MSGID = "id";
+ public static final String COLUMN_SEQUENCE_NUM = "seqNumber";
+ public static final String COLUMN_TIME = "time";
+ public static final String COLUMN_PAYLOAD = "payload";
+
+ private static final String TABLE_NAME_CALLSTACK_UNITS = "CallstackUnits";//$NON-NLS-1$
+ private static final String TABLE_NAME_CALLSTACK_DATA = "CallstackData";//$NON-NLS-1$
+ private static final String TABLE_NAME_FAILED_DATA = "FailedData";//$NON-NLS-1$
+ private static final String TABLE_NAME_LEAK_DATA = "LeakData";//$NON-NLS-1$
+ private static final String TABLE_NAME_PROFILING_DATA = "ProfilingData";//$NON-NLS-1$
+ private static final String TABLE_NAME_PROFILING_CHILD_DATA = "ProfilingChildData";//$NON-NLS-1$
+ private static final String TABLE_NAME_TARGET_INFO = "TargetInfo";//$NON-NLS-1$
+ private static final String TABLE_NAME_PROCESS_INFO = "ProcessInfo";//$NON-NLS-1$
+ private static final String TABLE_NAME_LIB_OBJ = "LibraryObject";//$NON-NLS-1$
+ private static final String TABLE_NAME_APINAME = "ApiName";//$NON-NLS-1$
private static List<DBTableInfo> tableInfos;
- public static final int TABLE_INDEX_APP_INFO = 0;
- public static final int TABLE_INDEX_CALLSTACK_UNITS = 1;
- public static final int TABLE_INDEX_CALLSTACK_DATA = 2;
- public static final int TABLE_INDEX_FAILED_DATA = 3;
- public static final int TABLE_INDEX_LEAK_DATA = 4;
- public static final int TABLE_INDEX_PROFILING_DATA = 5;
- public static final int TABLE_INDEX_PROFILING_CHILD_DATA = 6;
+ public static final int TABLE_INDEX_CALLSTACK_UNITS = 0;
+ public static final int TABLE_INDEX_CALLSTACK_DATA = 1;
+ public static final int TABLE_INDEX_FAILED_DATA = 2;
+ public static final int TABLE_INDEX_LEAK_DATA = 3;
+ public static final int TABLE_INDEX_PROFILING_DATA = 4;
+ public static final int TABLE_INDEX_PROFILING_CHILD_DATA = 5;
+ public static final int TABLE_INDEX_TARGET_INFO = 6;
+ public static final int TABLE_INDEX_PROCESS_INFO = 7;
+ public static final int TABLE_INDEX_LIB_OBJ = 8;
+ public static final int TABLE_INDEX_APINAME = 9;
public static final String EMPTY = CommonConstants.EMPTY;
public static final String TEXT = "TEXT";//$NON-NLS-1$
public static final String COMMON_COLUMN_RESERVED6 = "Reserved6";//$NON-NLS-1$
public static final String COMMON_COLUMN_RESERVED7 = "Reserved7";//$NON-NLS-1$
- public static final String CUSTOM_COLUMN_INFO = "info";//$NON-NLS-1$
public static final String CUSTOM_COLUMN_ADDR = "addr";//$NON-NLS-1$
public static final String CUSTOM_COLUMN_SEQ = "seq";//$NON-NLS-1$
public static final String CUSTOM_COLUMN_API = "api";//$NON-NLS-1$
public static final String CUSTOM_COLUMN_EXCL_EXETIME = "exclExeTime";//$NON-NLS-1$
public static final String CUSTOM_COLUMN_CHILD_LIST = "childList";//$NON-NLS-1$
- public static int TABLE_COUNT = 7;
+ public static final String TARGET_INFO_SYS_MEM_SIZE = "SystemMemorySize";//$NON-NLS-1$
+ public static final String TARGET_INFO_STORAGE_SIZE = "StorageSize";
+ public static final String TARGET_INFO_BLUETOOTH = "BlueTooth";
+ public static final String TARGET_INFO_GPS = "GPS";
+ public static final String TARGET_INFO_WIFI = "WiFi";
+ public static final String TARGET_INFO_CAMERA = "Camera";
+ public static final String TARGET_INFO_NETWORK = "Network";
+ public static final String TARGET_INFO_MAX_BRIGHT = "Brightness";
+ public static final String TARGET_INFO_CPU_CORE_COUNT = "CoreCount";
+
+ public static final String PROCESS_INFO_PID = "pid";//$NON-NLS-1$
+ public static final String PROCESS_INFO_START_TIME = "StartTime";
+ public static final String PROCESS_INFO_LOW_ADDR = "LowAddr";
+ public static final String PROCESS_INFO_HIGH_ADDR = "HighAddr";
+ public static final String PROCESS_INFO_APP_TYPE = "AppType";
+ public static final String PROCESS_INFO_BINARY_TYPE = "BinaryType";
+ public static final String PROCESS_INFO_BINARY_PATH = "BinaryPath";
+ public static final String PROCESS_INFO_DEPLIB_COUNT = "DepLibCount";
+
+ public static final String LIBRARY_OBJECT_LOW_ADDR = "LowAddr";
+ public static final String LIBRARY_OBJECT_HIGH_ADDR = "HighAddr";
+ public static final String LIBRARY_OBJECT_PATH = "LibraryPath";
+
+ public static final String APINAME_NAME = "name";
+
+ public static int TABLE_COUNT = 10;
public static final String[] commonColumns = { COMMON_COLUMN_RID,
COMMON_COLUMN_ID, COMMON_COLUMN_SEQ_NUMBER, COMMON_COLUMN_API_NAME,
// init tableInfo;
getTableInfos();
- // "app info" table info block
- {
- String[] names = { CUSTOM_COLUMN_INFO };
- String[] options = { EMPTY };
- String[] types = { TEXT };
- DBTableInfo appInfoTableInfo = new DBTableInfo(TABLE_NAME_APP_INFO,
- names, options, types);
- tableInfos.set(TABLE_INDEX_APP_INFO, appInfoTableInfo);
- }
-
// "callstack units" table info block
{
String[] names = { CUSTOM_COLUMN_ADDR, CUSTOM_COLUMN_API };
// "failed data" table info block
{
- String[] names = commonColumns;
- String[] options = commonOptions;
- String[] types = commonTypes;
+ String[] names = { "Rid", "MsgId", "Seq", "Time", "ApiName",
+ "Parameter", "Return", "ErrorCode", "CallerPc" };
+ String[] options = { EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY, EMPTY,
+ EMPTY, EMPTY, EMPTY };
+ String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
+ TEXT };
DBTableInfo failedDataTableInfo = new DBTableInfo(
TABLE_NAME_FAILED_DATA, names, options, types);
tableInfos.set(TABLE_INDEX_FAILED_DATA, failedDataTableInfo);
// "leak data" table info block
{
- String[] names = commonColumns;
- String[] options = commonOptions;
- String[] types = commonTypes;
+ String[] names = { "Rid", "MsgId", "Seq", "Time", "Address",
+ "ApiName", "Parameter", "Return", "Key", "LeakSeq",
+ "ParentKey", "CallerPc" };
+ // commonColumns;
+ String[] options = { EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY, EMPTY,
+ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY };
+ String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
+ TEXT, TEXT, TEXT, TEXT };
DBTableInfo leakDataTableInfo = new DBTableInfo(
TABLE_NAME_LEAK_DATA, names, options, types);
tableInfos.set(TABLE_INDEX_LEAK_DATA, leakDataTableInfo);
tableInfos.set(TABLE_INDEX_PROFILING_CHILD_DATA,
profilingChildTableInfo);
}
+
+ // target info
+ {
+ String[] names = { TARGET_INFO_SYS_MEM_SIZE,
+ TARGET_INFO_STORAGE_SIZE, TARGET_INFO_BLUETOOTH,
+ TARGET_INFO_GPS, TARGET_INFO_WIFI, TARGET_INFO_CAMERA,
+ TARGET_INFO_NETWORK, TARGET_INFO_MAX_BRIGHT,
+ TARGET_INFO_CPU_CORE_COUNT };
+ String[] options = { EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
+ EMPTY, EMPTY, EMPTY };
+ String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
+ TEXT };
+ DBTableInfo targetInfoTableInfo = new DBTableInfo(
+ TABLE_NAME_TARGET_INFO, names, options, types);
+ tableInfos.set(TABLE_INDEX_TARGET_INFO, targetInfoTableInfo);
+ }
+
+ // process info
+ {
+ String[] names = { PROCESS_INFO_PID, PROCESS_INFO_START_TIME,
+ PROCESS_INFO_LOW_ADDR, PROCESS_INFO_HIGH_ADDR,
+ PROCESS_INFO_APP_TYPE, PROCESS_INFO_BINARY_TYPE,
+ PROCESS_INFO_BINARY_PATH, PROCESS_INFO_DEPLIB_COUNT };
+ String[] options = { EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
+ EMPTY, EMPTY };
+ String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT };
+ DBTableInfo processInfoTableInfo = new DBTableInfo(
+ TABLE_NAME_PROCESS_INFO, names, options, types);
+ tableInfos.set(TABLE_INDEX_PROCESS_INFO, processInfoTableInfo);
+ }
+
+ // library object
+ {
+ String[] names = { LIBRARY_OBJECT_LOW_ADDR,
+ LIBRARY_OBJECT_HIGH_ADDR, LIBRARY_OBJECT_PATH };
+ String[] options = { EMPTY, EMPTY, EMPTY };
+ String[] types = { TEXT, TEXT, TEXT };
+ DBTableInfo libObjTableInfo = new DBTableInfo(TABLE_NAME_LIB_OBJ,
+ names, options, types);
+ tableInfos.set(TABLE_INDEX_LIB_OBJ, libObjTableInfo);
+ }
+
+ // api name map
+ {
+ String[] names = { APINAME_NAME };
+ String[] options = { EMPTY };
+ String[] types = { TEXT };
+ DBTableInfo apiName = new DBTableInfo(TABLE_NAME_APINAME,
+ names, options, types);
+ tableInfos.set(TABLE_INDEX_APINAME, apiName);
+ }
}
public DBTableInfo getTableInfo(int tableInfoIndex) {
*/
package org.tizen.dynamicanalyzer.sql;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.COMMA;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.SPACE;
+import static org.tizen.dynamicanalyzer.sql.DBTableManager.TEXT;
+
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+import org.tizen.dynamicanalyzer.swap.model.data.LibraryObject;
+import org.tizen.dynamicanalyzer.swap.model.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LeakData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class SqlManager {
- private final int PERMIT = 1;
+ private static final int PERMIT = 1;
private Semaphore semaphore = new Semaphore(PERMIT);
private static SqlManager instance = null;
private Connection connection = null;
}
// create query
- public synchronized void createTable(LogCenter lcenter) {
+ public synchronized void createTable(int id) {
+ Statement stat = null;
try {
Connection conn = getConnection();
if (null == conn) {
return;
}
semaphoreAcquire();
- Statement stat = conn.createStatement();
- stat.executeUpdate(createDropTableQuery(lcenter.getName()));
- stat.executeUpdate(createTableQuery(lcenter));
+ stat = conn.createStatement();
+ stat.executeUpdate(createDropTableQuery(LogDataFactory
+ .getTableNamebyId(id)));
+ stat.executeUpdate(createTableQuery(id));
} catch (SQLException e) {
e.printStackTrace();
} finally {
+ AnalyzerUtil.tryClose(stat);
semaphoreRelease();
}
}
- private String createTableQuery(LogCenter lcenter) {
+ private String createTableQuery(int id) {
StringBuffer query = new StringBuffer();
query.append("create table "); //$NON-NLS-1$
- query.append(lcenter.getName());
+ String name = LogDataFactory.getTableNamebyId(id);
+ query.append(name);
query.append(CommonConstants.SPACE + CommonConstants.OPEN_BRACKET);
- List<String> columnName = lcenter.getColumnName();
- List<String> columnType = lcenter.getType();
- int size = lcenter.getTotalColumnCount();
- for (int i = 0; i < size; i++) {
- query.append(columnName.get(i) + CommonConstants.SPACE
- + columnType.get(i));
- if (i + 1 == size) {
- query.append(CommonConstants.CLOSE_BRACKET
- + CommonConstants.SEMICOLON);
- break;
- } else {
- query.append(CommonConstants.COMMA);
- }
- }
+
+ // TODO: constants
+ String column = "Rid INTEGER, ID INTEGER, SeqNumber INTEGER PRIMARY KEY NOT NULL, Time TEXT, payload BLOB";
+
+ query.append(column).append(CommonConstants.CLOSE_BRACKET)
+ .append(CommonConstants.SEMICOLON);
return query.toString();
}
public void createProjectTable(Project project) {
+ Statement stat = null;
try {
Connection conn = getConnection();
if (null == conn) {
return;
}
semaphoreAcquire();
- Statement stat = conn.createStatement();
- stat.executeUpdate(createDropTableQuery("project")); //$NON-NLS-1$
- String query = "create table project (info TEXT not null)"; //$NON-NLS-1$
- stat.executeUpdate(query);
+ stat = conn.createStatement();
+ stat.executeUpdate(createDropTableQuery(Project.TABLE_NAME)); //$NON-NLS-1$
+
+ StringBuffer buf = new StringBuffer("create table ").append(
+ Project.TABLE_NAME).append(" (");
+ buf.append(Project.APP_NAME).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.CREATE_TIME).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.SAVE_PATH).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.LOG_NUMS).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.SAVE_VERSION).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.DEVICE).append(SPACE).append(TEXT).append(COMMA);
+ buf.append(Project.LAST_TIME).append(SPACE).append(TEXT)
+ .append(COMMA);
+ buf.append(Project.STOP_TIME).append(SPACE).append(TEXT);
+ buf.append(CommonConstants.CLOSE_BRACKET).append(
+ CommonConstants.SEMICOLON);
+ stat.executeUpdate(buf.toString());
} catch (SQLException e) {
e.printStackTrace();
} finally {
+ AnalyzerUtil.tryClose(stat);
semaphoreRelease();
}
}
}
public void createTables() {
+ Statement stat = null;
try {
Connection conn = getConnection();
if (null == conn) {
}
semaphoreAcquire();
DBTableManager dbManager = DBTableManager.getInstance();
- Statement stat = conn.createStatement();
- if (!executeUpdateCreateTable(stat,
- dbManager.getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(
- stat,
- dbManager.getTableInfo(
- DBTableManager.TABLE_INDEX_CALLSTACK_UNITS)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(
- stat,
- dbManager.getTableInfo(
- DBTableManager.TABLE_INDEX_CALLSTACK_DATA)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(stat,
- dbManager
- .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(
- stat,
- dbManager.getTableInfo(
- DBTableManager.TABLE_INDEX_FAILED_DATA)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(
- stat,
- dbManager.getTableInfo(
- DBTableManager.TABLE_INDEX_PROFILING_DATA)
- .createQuery())) {
- return;
- }
- if (!executeUpdateCreateTable(
- stat,
- dbManager.getTableInfo(
- DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA)
- .createQuery())) {
- return;
+ stat = conn.createStatement();
+
+ List<DBTableInfo> tableInfos = dbManager.getTableInfos();
+ for (DBTableInfo info : tableInfos) {
+ if (!executeUpdateCreateTable(stat, info.createQuery())) {
+ System.out.println("table create failed..."
+ + info.getTableName());
+ }
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
+ AnalyzerUtil.tryClose(stat);
semaphoreRelease();
}
}
* insert data
* @return success/failed
*/
- public boolean insertQuery(String query, List<List<String>> input) {
+ public boolean insertLogQuery(String query, List<LogData> input) {
PreparedStatement prep = null;
try {
Connection conn = getConnection();
prep = conn.prepareStatement(query);
int dataRowSize = input.size();
for (int i = 0; i < dataRowSize; i++) {
- List<String> rowData = input.get(i);
- int columnSize = rowData.size();
- for (int j = 0; j < columnSize; j++) {
- prep.setString(j + 1, rowData.get(j));
- }
+ LogData log = input.get(i);
+ prep.setInt(1, log.getLogNum());
+ prep.setInt(2, log.getId());
+ prep.setInt(3, log.getSeq());
+ prep.setLong(4, log.getTime());
+ prep.setBytes(5, log.getPayload());
prep.addBatch();
}
conn.setAutoCommit(false);
return true;
}
- public String createInsertQuery(LogCenter logcs) {
- StringBuffer query = new StringBuffer();
- query.append("insert into "); //$NON-NLS-1$
- query.append(logcs.getName());
- query.append(" values ("); //$NON-NLS-1$
-
- int size = logcs.getTotalColumnCount();
- for (int i = 0; i < size; i++) {
- query.append("?"); //$NON-NLS-1$
- if (i + 1 == size) {
- query.append(CommonConstants.CLOSE_BRACKET
- + CommonConstants.SEMICOLON);
- break;
- } else {
- query.append(CommonConstants.COMMA);
- }
- }
- return query.toString();
- }
-
public void insertProject() {
- String insertQuery = "insert into project values ( ? );"; //$NON-NLS-1$
-
- List<List<String>> insetData = new ArrayList<List<String>>();
- List<LogCenter> logcs = AnalyzerManager.getLogCenters();
+ String insertQuery = "insert into project values ( ?, ?, ?, ?, ?, ?, ?, ? );"; //$NON-NLS-1$
Project project = AnalyzerManager.getProject();
- /* project version index = 0 */
List<String> insetRowData = new ArrayList<String>();
- insetRowData.add(project.getVersion());
- insetData.add(insetRowData);
- /* project create time index = 1 */
- insetRowData = new ArrayList<String>();
- insetRowData.add(project.getCreateTime());
- insetData.add(insetRowData);
- /* project application name index = 2 */
- insetRowData = new ArrayList<String>();
+
insetRowData.add(project.getAppName());
- insetData.add(insetRowData);
- /* project device index = 3 */
- insetRowData = new ArrayList<String>();
- insetRowData.add(project.getDevice());
- insetData.add(insetRowData);
- /* project last log number index = 4 */
- insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getCreateTime());
+ insetRowData.add(project.getSavePath());
insetRowData.add(project.getLastLogNumbers());
- insetData.add(insetRowData);
- /* project last recording time index = 5 */
- insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getVersion());
+ insetRowData.add(project.getDevice());
insetRowData.add(Long.toString(project.getLastTime()));
+ insetRowData.add(Long.toString(project.getStopTime()));
+
+ List<List<String>> insetData = new ArrayList<List<String>>();
insetData.add(insetRowData);
- /* project total sample count index = 6 */
- insetRowData = new ArrayList<String>();
- insetRowData.add(Integer.toString(project
- .getTotalProfilingSampleCount()));
- insetData.add(insetRowData);
- /* project package id index = 7 */
- insetRowData = new ArrayList<String>();
- insetRowData.add(project.getPkgId());
+
+ insertQuery(insertQuery, insetData);
+ }
+
+ public void insertTargetInfo() {
+ DBTableInfo info = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_TARGET_INFO);
+
+ String insertQuery = "insert into " + info.getTableName() + " values ( ?, ?, ?, ?, ?, ?, ?, ?, ? );"; //$NON-NLS-1$
+
+ TargetInfo targetInfo = AnalyzerManager.getProject().getTargetInfo();
+ List<String> insetRowData = new ArrayList<String>();
+
+ insetRowData.add(Long.toString(targetInfo.getSystemMemorySize()));
+ insetRowData.add(Long.toString(targetInfo.getStorageSize()));
+ insetRowData.add(Integer.toString(targetInfo.getBluetoothSupport()));
+ insetRowData.add(Integer.toString(targetInfo.getGpsSupport()));
+ insetRowData.add(Integer.toString(targetInfo.getWifiSupport()));
+ insetRowData.add(Integer.toString(targetInfo.getCameraCount()));
+ insetRowData.add(targetInfo.getNetworkType());
+ insetRowData.add(Integer.toString(targetInfo.getMaxBrightness()));
+ insetRowData.add(Integer.toString(targetInfo.getCpuCount()));
+
+ List<List<String>> insetData = new ArrayList<List<String>>();
insetData.add(insetRowData);
- /* project stop time id index = 8 */
- insetRowData = new ArrayList<String>();
- insetRowData.add(Long.toString(project.getStopTime()));
+
+ insertQuery(insertQuery, insetData);
+ }
+
+ public void insertProcessInfo() {
+ DBTableInfo info = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_PROCESS_INFO);
+ String insertQuery = "insert into " + info.getTableName() + " values ( ?, ?, ?, ?, ?, ?, ?, ? );"; //$NON-NLS-1$
+
+ ProcessInfo pInfo = AnalyzerManager.getProject().getProcessInfo();
+ List<String> insetRowData = new ArrayList<String>();
+
+ insetRowData.add(Integer.toString(pInfo.getPid()));
+ insetRowData.add(Long.toString(pInfo.getTime()));
+ insetRowData.add(Long.toString(pInfo.getLowestAddress()));
+ insetRowData.add(Long.toString(pInfo.getHighestAddress()));
+ insetRowData.add(Integer.toString(pInfo.getAppType()));
+ insetRowData.add(Integer.toString(pInfo.getBinaryType()));
+ insetRowData.add(pInfo.getBinaryPath());
+ insetRowData.add(Integer.toString(pInfo.getDepLibCount()));
+
+ List<List<String>> insetData = new ArrayList<List<String>>();
insetData.add(insetRowData);
- /* project logcenters index = reminders */
- int size = logcs.size();
- for (int i = 0; i < size; i++) {
- insetRowData = new ArrayList<String>();
- try {
- insetRowData.add(logcs.get(i).getName());
- insetData.add(insetRowData);
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- }
insertQuery(insertQuery, insetData);
+ insertLibObj(pInfo.getLibObjs());
}
- public void insert(LogCenter logc, List<List<String>> input)
- throws InterruptedException {
+ private void insertLibObj(List<LibraryObject> libs) {
+ DBTableInfo info = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_LIB_OBJ);
+ String insertQuery = "insert into " + info.getTableName() + " values ( ?, ?, ?);"; //$NON-NLS-1$
+
List<List<String>> insetData = new ArrayList<List<String>>();
- String insertQuery = logc.getInsertQuery();
- int dataSize = input.size();
- for (int inputIndex = 0; inputIndex < dataSize; inputIndex++) {
+ for (LibraryObject lib : libs) {
List<String> insetRowData = new ArrayList<String>();
- List<String> log = input.get(inputIndex);
- int size = logc.getTotalColumnCount();
- insetRowData.add(Integer.toString(logc.getIndex()));
- for (int i = 0; i < size; i++) {
+ insetRowData.add(Long.toString(lib.getLowestAddress()));
+ insetRowData.add(Long.toString(lib.getHighestAddress()));
+ insetRowData.add(lib.getLibPath());
+ insetData.add(insetRowData);
+ }
+
+ insertQuery(insertQuery, insetData);
+ }
+
+ public boolean insertQuery(String query, List<List<String>> input) {
+ PreparedStatement prep = null;
+ try {
+ Connection conn = getConnection();
+ if (null == conn || null == query || null == input) {
+ System.out.println("failed sql inset : " + input);
+ return false;
+ }
+ semaphoreAcquire();
+ prep = conn.prepareStatement(query);
+ int dataRowSize = input.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ List<String> rowData = input.get(i);
+ int columnSize = rowData.size();
+ for (int j = 0; j < columnSize; j++) {
+ prep.setString(j + 1, rowData.get(j));
+ }
+ prep.addBatch();
+ }
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (null != prep) {
try {
- if (i + 2 > size) {
- break;
- }
- insetRowData.add(log.get(i));
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println("sql insert exception : index " + i); //$NON-NLS-1$
+ prep.close();
+ } catch (SQLException e) {
e.printStackTrace();
}
}
- insetData.add(insetRowData);
- logc.addIndex();
+ semaphoreRelease();
}
- insertQuery(insertQuery, insetData);
+ return true;
+ }
+
+ public void insert(int logId, List<LogData> input)
+ throws InterruptedException {
+ String tableName = LogDataFactory.getTableNamebyId(logId);
+ // String insertQuery = logc.getInsertQuery();
+ String insertQuery = "insert into " + tableName
+ + " values( ?, ?, ?, ?, ?);";
+ // int dataSize = input.size();
+ // for (int inputIndex = 0; inputIndex < dataSize; inputIndex++) {
+ // List<String> insetRowData = new ArrayList<String>();
+ // List<String> log = input.get(inputIndex);
+ // int size = logc.getTotalColumnCount();
+ // insetRowData.add(Integer.toString(logc.getIndex()));
+ // for (int i = 0; i < size; i++) {
+ // try {
+ // if (i + 2 > size) {
+ // break;
+ // }
+ // insetRowData.add(log.get(i));
+ // } catch (ArrayIndexOutOfBoundsException e) {
+ // System.out.println("sql insert exception : index " + i); //$NON-NLS-1$
+ // e.printStackTrace();
+ // }
+ // }
+ // insetData.add(insetRowData);
+ // logc.addIndex();
+ // }
+ insertLogQuery(insertQuery, input);
}
LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
DBTableInfo leakTableInfo = DBTableManager.getInstance().getTableInfo(
DBTableManager.TABLE_INDEX_LEAK_DATA);
- List<List<String>> insetData = new ArrayList<List<String>>();
String insertQuery = leakTableInfo.insertQuery();
- int size = leakTableInfo.getColumnNames().length;
+ List<LeakData2> leakList = leakDectector.getLeakDataList();
+ List<LeakData2> insertData = new ArrayList<LeakData2>();
+ for (LeakData2 leakData : leakList) {
+ insertData.add(leakData);
+ if (!leakData.getChildren().isEmpty()) {
+ List<LeakData2> children = leakData.getChildren();
+ for (LeakData2 child : children) {
+ insertData.add(child);
+ }
+ }
+ }
+ insertLeakQuery(insertQuery, insertData);
+ }
- List<LeakData> leakList = leakDectector.getLeakDataList();
- for (LeakData leakData : leakList) {
- List<String> insetRowData = new ArrayList<String>();
- for (int ii = 0; ii < size; ii++) {
- insetRowData.add(leakData.getData().get(ii));
+ private boolean insertLeakQuery(String query, List<LeakData2> input) {
+ PreparedStatement prep = null;
+ try {
+ Connection conn = getConnection();
+ if (null == conn || null == query || null == input) {
+ System.out.println("failed sql inset : " + input);
+ return false;
}
- insetData.add(insetRowData);
- if (!leakData.getChildren().isEmpty()) {
- List<LeakData> children = leakData.getChildren();
- for (LeakData child : children) {
- for (int ii = 0; ii < size; ii++) {
- insetRowData.add(child.getData().get(ii));
- }
- insetData.add(insetRowData);
+ semaphoreAcquire();
+ prep = conn.prepareStatement(query);
+ int dataRowSize = input.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ LeakData2 data = input.get(i);
+ prep.setInt(1, LeakData2.getLogNum());
+ prep.setInt(2, data.getId());
+ prep.setInt(3, data.getSeq());
+ prep.setLong(4, data.getTime());
+ prep.setLong(5, data.getAddr());
+ prep.setString(6, data.getName());
+ prep.setString(7, data.getParam());
+ prep.setLong(8, data.getRet());
+ prep.setInt(9, data.getKey());
+ prep.setInt(10, data.getLeakSeq());
+ prep.setInt(11, data.getParentKey());
+ prep.setLong(12, data.getCallerPc());
+ prep.addBatch();
+ }
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (null != prep) {
+ try {
+ prep.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
}
}
+ semaphoreRelease();
}
- insertQuery(insertQuery, insetData);
+ return true;
}
public void saveFailedData() {
FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
- List<FailedData> failedList = failedChecker.getFailedList();
+ List<FailedData2> failedList = failedChecker.getFailedList();
DBTableInfo failedTableInfo = DBTableManager.getInstance()
.getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA);
- List<List<String>> insetData = new ArrayList<List<String>>();
String insertQuery = failedTableInfo.insertQuery();
- String[] columns = DBTableManager.commonColumns;
- int size = columns.length;
- int count = failedList.size();
- for (int i = 0; i < count; i++) {
- List<String> insetRowData = new ArrayList<String>();
- FailedData failedData = failedList.get(i);
- int dataSize = failedData.getData().size();
- for (int ii = 0; ii < size; ii++) {
- if (ii >= dataSize) {
- insetRowData.add(CommonConstants.EMPTY);
- } else {
- insetRowData.add(failedData.getData().get(ii));
+ insertFailedQuery(insertQuery, failedList);
+ }
+
+ public void saveApiNames() {
+ List<String> apiNames = ApiNameManager.getApiList();
+
+ DBTableInfo apiNameInfo = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_APINAME);
+ String insertQuery = apiNameInfo.insertQuery();
+ insertApiNameQuery(insertQuery, apiNames);
+ }
+
+ private boolean insertFailedQuery(String query, List<FailedData2> input) {
+ PreparedStatement prep = null;
+ try {
+ Connection conn = getConnection();
+ if (null == conn || null == query || null == input) {
+ System.out.println("failed sql inset : " + input);
+ return false;
+ }
+ semaphoreAcquire();
+ prep = conn.prepareStatement(query);
+ int dataRowSize = input.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ FailedData2 data = input.get(i);
+ prep.setInt(1, LeakData2.getLogNum());
+ prep.setInt(2, data.getId());
+ prep.setInt(3, data.getSeq());
+ prep.setLong(4, data.getTime());
+ prep.setString(5, data.getName());
+ prep.setString(6, data.getArgs());
+ prep.setLong(7, data.getReturn());
+ prep.setLong(8, data.getErrorCode());
+ prep.setLong(4, data.getCallerPc());
+ prep.addBatch();
+ }
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (null != prep) {
+ try {
+ prep.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
}
- insetData.add(insetRowData);
}
+ semaphoreRelease();
}
- insertQuery(insertQuery, insetData);
+ return true;
+ }
+
+ private boolean insertApiNameQuery(String query, List<String> input) {
+ PreparedStatement prep = null;
+ try {
+ Connection conn = getConnection();
+ if (null == conn || null == query || null == input) {
+ System.out.println("failed sql inset : " + input);
+ return false;
+ }
+ semaphoreAcquire();
+ prep = conn.prepareStatement(query);
+ int dataRowSize = input.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ String data = input.get(i);
+ prep.setString(1, data);
+ prep.addBatch();
+ }
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ if (null != prep) {
+ try {
+ prep.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ semaphoreRelease();
+ }
+ return true;
}
public void saveCallStackUnits() {
insertQuery(insertQuery, insetData);
}
- public void saveAppInfo() {
- DBTableInfo appInfoData = DBTableManager.getInstance().getTableInfo(
- DBTableManager.TABLE_INDEX_APP_INFO);
- String insertQuery = appInfoData.insertQuery();
- List<String> info = AnalyzerManager.getProject().getAppInfo();
- int size = info.size();
- List<List<String>> insetData = new ArrayList<List<String>>();
- for (int i = 0; i < size; i++) {
- List<String> insetRowData = new ArrayList<String>();
- insetRowData.add(info.get(i));
- insetData.add(insetRowData);
- }
- insertQuery(insertQuery, insetData);
- }
+ // public void saveAppInfo() {
+ // DBTableInfo appInfoData = DBTableManager.getInstance().getTableInfo(
+ // DBTableManager.TABLE_INDEX_APP_INFO);
+ // String insertQuery = appInfoData.insertQuery();
+ // List<String> info = AnalyzerManager.getProject().getAppInfo();
+ // int size = info.size();
+ // List<List<String>> insetData = new ArrayList<List<String>>();
+ // for (int i = 0; i < size; i++) {
+ // List<String> insetRowData = new ArrayList<String>();
+ // insetRowData.add(info.get(i));
+ // insetData.add(insetRowData);
+ // }
+ // insertQuery(insertQuery, insetData);
+ // }
public void saveProfilingData() {
ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
.getProfileDataMaker();
- HashMap<String, ProfilingData> profilingDataMap = profiler
+ HashMap<Integer, ProfilingData> profilingDataMap = profiler
.getProfilingDataMap();
List<ProfilingData> pDataList = new ArrayList<ProfilingData>();
pDataList.addAll(profilingDataMap.values());
* Condition statements
* @return List<List<String>> row of columns data
*/
+ public List<LogData> newSelectQuery(String dbFilePath, String[] columnName,
+ String tableName, String option) {
+ String query = null;
+ Statement stat = null;
+ ResultSet rs = null;
+ Connection conn = null;
+ List<LogData> dbInfo = new ArrayList<LogData>();
+ try {
+ if (null == dbFilePath) {
+ conn = getConnection();
+ } else {
+ conn = getConnection(dbFilePath);
+ }
+ if (null == conn) {
+ return null;
+ }
+ semaphoreAcquire();
+ if (null == tableName || tableName.length() < 1) {
+ System.out.println("tableName is null");
+ return null;
+ }
+
+ StringBuilder columns = new StringBuilder();
+ if (null == columnName || columnName.length < 1) {
+ System.out.println("tableName is null");
+ return null;
+ } else {
+ for (int i = 0; i < columnName.length; i++) {
+ if ((0 < i) && (i < columnName.length)) {
+ columns.append(", ");//$NON-NLS-1$
+ }
+ columns.append(columnName[i]);
+ }
+ }
+ String queryOption = CommonConstants.EMPTY;
+ if (null != option) {
+ queryOption = option;
+ }
+ query = String.format("select %s from %s %s;",//$NON-NLS-1$
+ columns.toString(), tableName, queryOption);
+
+ stat = conn.createStatement();
+ rs = stat.executeQuery(query);
+ if (null == rs) {
+ return null;
+ }
+
+ while (rs.next()) {
+ // int rowId = rs.getInt(1);
+ int id = rs.getInt(2);
+ int seq = rs.getInt(3);
+ long time = rs.getLong(4);
+ byte[] payload = rs.getBytes(5);
+ BasicDataMessage basicData = new BasicDataMessage();
+ basicData.setId(id);
+ basicData.setSeq(seq);
+ basicData.setTime(time);
+ basicData.setPayload(payload);
+
+ LogData logdata = LogDataFactory.createInstance(basicData);
+
+ dbInfo.add(logdata);
+ }
+ } catch (SQLException e) {
+ System.out.println("SQLException - selecte : " + query);
+ e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(stat, rs);
+ if (null != conn) {
+ semaphoreRelease();
+ }
+ if (null != dbFilePath) {
+ closeConnection();
+ }
+
+ }
+ return dbInfo;
+ }
+
+ public List<LogData> selectQuery2(String dbFilePath, String tableName,
+ String option) {
+ String query = null;
+ Statement stat = null;
+ ResultSet rs = null;
+ Connection conn = null;
+ List<LogData> logs = null;
+ try {
+ if (null == dbFilePath) {
+ conn = getConnection();
+ } else {
+ conn = getConnection(dbFilePath);
+ }
+ if (null == conn) {
+ return null;
+ }
+ semaphoreAcquire();
+ if (null == tableName || tableName.length() < 1) {
+ System.out.println("tableName is null");
+ return null;
+ }
+
+ StringBuilder columns = new StringBuilder();
+ columns.append("Rid , ID , SeqNumber , Time , payload ");
+ String queryOption = CommonConstants.EMPTY;
+ if (null != option) {
+ queryOption = option;
+ }
+ query = String.format("select %s from %s %s;",//$NON-NLS-1$
+ columns.toString(), tableName, queryOption);
+
+ stat = conn.createStatement();
+ rs = stat.executeQuery(query);
+ if (null == rs) {
+ return null;
+ }
+ logs = new ArrayList<LogData>();
+ while (rs.next()) {
+ BasicDataMessage bdm = new BasicDataMessage();
+ bdm.setId(rs.getInt(2));
+ bdm.setSeq(rs.getInt(3));
+ bdm.setTime(rs.getLong(4));
+ bdm.setPayload(rs.getBytes(5));
+ LogData log = LogDataFactory.createInstance(bdm);
+ logs.add(log);
+ }
+ } catch (SQLException e) {
+ System.out.println("SQLException - selecte : " + query);
+ e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(stat, rs);
+ if (null != conn) {
+ semaphoreRelease();
+ }
+ if (null != dbFilePath) {
+ closeConnection();
+ }
+
+ }
+ return logs;
+ }
+
public List<List<String>> selectQuery(String dbFilePath,
String[] columnName, String tableName, String option) {
List<List<String>> dbInfo = null;
}
} catch (SQLException e) {
System.out.println("SQLException - selecte : " + query);
+ e.printStackTrace();
} finally {
- try {
- if (null != rs) {
- rs.close();
- }
- if (null != stat) {
- stat.close();
- }
- } catch (SQLException e) {
- System.out.println("Finally SQLException - selecte : " + query);
- }
+ AnalyzerUtil.tryClose(stat, rs);
if (null != conn) {
semaphoreRelease();
}
.getTableName(), null);
}
- public List<List<String>> setloadAppInfo() {
+ public List<List<String>> loadTargetInfo() {
return selectQuery(
null,
DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO)
+ .getTableInfo(DBTableManager.TABLE_INDEX_TARGET_INFO)
.getColumnNames(), DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO)
+ .getTableInfo(DBTableManager.TABLE_INDEX_TARGET_INFO)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> loadProcessInfo() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROCESS_INFO)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROCESS_INFO)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> loadLibObj() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_LIB_OBJ)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_LIB_OBJ)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> loadApiNames() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_APINAME)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_APINAME)
.getTableName(), null);
}
}
public List<String> getDetailsInfo(String path) {
- List<List<String>> dbInfo = new ArrayList<List<String>>();
- dbInfo = selectQuery(path, new String[] { "info" }, "project", null);//$NON-NLS-1$//$NON-NLS-2$
- if (dbInfo == null) {
+ List<List<String>> dbInfo = selectQuery(path, new String[] {
+ Project.APP_NAME, Project.CREATE_TIME, Project.SAVE_PATH,
+ Project.LOG_NUMS, Project.SAVE_VERSION, Project.DEVICE,
+ Project.LAST_TIME, Project.STOP_TIME }, Project.TABLE_NAME,
+ null);
+ if (dbInfo == null || dbInfo.isEmpty()) {
return null;
}
- List<String> pInfo = new ArrayList<String>();
- for (int i = 0; i < dbInfo.size(); i++) {
- pInfo.add(dbInfo.get(i).get(0));
- }
- return pInfo;
+ return dbInfo.get(0);
}
public synchronized List<List<String>> selectRowId(LogCenter center,
return dbInfo;
}
- public int selectCount(LogCenter logCenter) {
- List<List<String>> dbInfo = selectQuery(null,
- new String[] { "count(SeqNumber)" }, logCenter.getName(), null);
- if (null == dbInfo || null == dbInfo.get(0).get(0)) {
- return 0;
- }
- return Integer.parseInt(dbInfo.get(0).get(0));
- }
-
public int executeSelectIndexOperation(long time) {
String queryOptin = " where time < " + time + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER; //$NON-NLS-1$ //$NON-NLS-2$
List<List<String>> dbInfo = selectQuery(null,
return Integer.parseInt(dbInfo.get(0).get(0));
}
- public List<String> getCpuRates(long startTime, int type) {
+ public LogData getCpuRates(long startTime, int type) {
String queryOption = null;
if (type == 1) {
queryOption = "where time = (select max(time) from system where time <= " + startTime + ")"; //$NON-NLS-1$
} else {
queryOption = "where time = (select min(time) from system)"; //$NON-NLS-1$
}
- List<List<String>> dbInfo = selectQuery(null, new String[] {
- "SystemCpuUsage", "ResidentMemory" }, "system", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
- if (null == dbInfo || dbInfo.size() == 0) {
+ List<LogData> dbInfo = selectQuery2(null, "system", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || dbInfo.isEmpty()) {
return null;
}
- List<String> pInfo = new ArrayList<String>();
- for (int i = 0; i < 2; i++) {
- pInfo.add(dbInfo.get(0).get(i));
- }
- return pInfo;
+ return dbInfo.get(0);
}
- public String getLastSnapshotTime(String time) {
+ public long getLastSnapshotTime(long time) {
String queryOption = "where time >=" + time;//$NON-NLS-1$
List<List<String>> dbInfo = selectQuery(null,
new String[] { "min(time)" }, "screenshot", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
if (null == dbInfo || dbInfo.isEmpty()) {
- return null;
+ return -1;
}
- return dbInfo.get(0).get(0);
+ return Long.parseLong(dbInfo.get(0).get(0));
}
public List<List<String>> getloadImageSet(int size) {
return dbInfo;
}
- public int getRangeMinSeq(String tableName, long time) {
+ public int getRangeMinSeq(int logId, long time) {
+ String tableName = LogDataFactory.getTableNamebyId(logId);
String queryOption = " where time >= " + time; //$NON-NLS-1$
List<List<String>> dbInfo = selectQuery(null,
new String[] { "min(seqnumber)" }, tableName, queryOption); //$NON-NLS-1$ //$NON-NLS-2$
return Integer.parseInt(dbInfo.get(0).get(0));
}
- public int getRangeMaxSeq(String tableName, long time) {
+ public int getRangeMaxSeq(int logId, long time) {
+ String tableName = LogDataFactory.getTableNamebyId(logId);
String queryOption = " where time <= " + time; //$NON-NLS-1$
List<List<String>> dbInfo = selectQuery(null,
new String[] { "max(seqnumber)" }, tableName, queryOption); //$NON-NLS-1$ //$NON-NLS-2$
return Integer.parseInt(dbInfo.get(0).get(0));
}
- public List<List<String>> selectArea(LogCenter center, long from, long to) {
+ public List<LogData> selectArea(int logId, long from, long to) {
+ String tableName = LogDataFactory.getTableNamebyId(logId);
StringBuffer queryOption = new StringBuffer();
queryOption.append(" where SeqNumber >= "); //$NON-NLS-1$
queryOption.append(from);
queryOption.append(" and SeqNumber <= "); //$NON-NLS-1$
queryOption.append(to);
- String[] columnNames = center.getColumnName().toArray(
- new String[center.getColumnName().size()]);
- List<List<String>> dbInfo = selectQuery(null, columnNames,
- center.getName(), queryOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
-
- List<List<String>> output = new ArrayList<List<String>>();
-
- for (int i = 0; i < dbInfo.size(); i++) {
- List<String> pInfo = dbInfo.get(i);
- List<String> inner = new ArrayList<String>();
- int size = pInfo.size();
- for (int j = 0; j < size; j++) {
- if (j + 1 >= size) {
- break;
- }
- inner.add(pInfo.get(j + 1));
- }
- output.add(inner);
- }
- return output;
+ String[] columnNames = { DBTableManager.COLUMN_ROWID,
+ DBTableManager.COLUMN_MSGID,
+ DBTableManager.COLUMN_SEQUENCE_NUM, DBTableManager.COLUMN_TIME,
+ DBTableManager.COLUMN_PAYLOAD };
+ List<LogData> dbInfo = newSelectQuery(null, columnNames, tableName,
+ queryOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return dbInfo;
}
}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.communicator;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.control.ApplicationInfo;
+import org.tizen.dynamicanalyzer.swap.model.control.RunTimeConfiguration;
+import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
+import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
+
+public class Communicator30 extends BaseCommunicator {
+
+ @Override
+ public HostResult init() {
+ // daemon start
+ List<DeviceInfo> devices = DACommunicator.getDevices();
+ // DeviceInfo selDevice = DACommunicator.getSelectedDevice();
+ for (DeviceInfo devInfo : devices) {
+ CommunicatorUtils.execCommand(devInfo.getIDevice(),
+ AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
+ }
+
+ // get port
+ for (DeviceInfo devInfo : devices) {
+ int remotePort = CommunicatorUtils.getRemotePort(DACommunicator
+ .getSelectedDevice().getIDevice());
+ if (remotePort < 0) {
+ System.out.println(devInfo.getIDevice().getSerialNumber()
+ + " remote port get failed and remove this device");
+ devices.remove(devInfo);
+ } else {
+ devInfo.setRemotePort(remotePort);
+ }
+ }
+
+ // create control socket
+ for (DeviceInfo devInfo : devices) {
+ HostResult result = createControlSocket(devInfo);
+ if (!result.isSuccess()) {
+ System.out.println(result.toString());
+ }
+ }
+ // create data socket - not create data receive thread
+ for (DeviceInfo devInfo : devices) {
+ HostResult result = createDataSocket(devInfo);
+ if (!result.isSuccess()) {
+ System.out.println(result.toString());
+ }
+ }
+
+ // target info get
+ for (DeviceInfo devInfo : devices) {
+ HostResult result = getTargetInfo(devInfo);
+ if (!result.isSuccess()) {
+ System.out.println(result.toString());
+ }
+ }
+
+ // heart beat thread start
+
+ Thread heartBeat = new Thread(null, new HeartBeatThread(),
+ AnalyzerConstants.HEART_BEAT_THREAD);
+ heartBeat.start();
+
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public HostResult startTrace() {
+ // binary info message send
+ byte[] ret = ByteUtils.toBytes(AnalyzerConstants.MSG_START_SWAP);
+ ApplicationInfo testAppInfo = new ApplicationInfo();
+ testAppInfo.setAppId("test");
+ testAppInfo.setExecPath("/apps/bin/testApp");
+
+ RunTimeConfiguration rt = new RunTimeConfiguration();
+ rt.setFeatures(ConfigureManager.getInstance().getConfiguration());
+
+ ret = ByteUtils.concatByteArray(ret, testAppInfo.getByteValue(), rt.getByteValue());
+ // data receive thread create and start
+ // start message send
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public HostResult sendRuntimeMessage(int type, String message) {
+ // send config message
+ byte[] ret = ByteUtils.toBytes(AnalyzerConstants.MSG_CONFIG);
+ RunTimeConfiguration rt = new RunTimeConfiguration();
+ rt.setFeatures(ConfigureManager.getInstance().getConfiguration());
+ ret = ByteUtils.concatByteArray(ret, rt.getByteValue());
+ // send swap inst message
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public HostResult stopTrace() {
+ // TODO Auto-generated method stub
+ byte[] ret = ByteUtils.toBytes(AnalyzerConstants.MSG_STOP_SWAP);
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public HostResult exit() {
+ // kill daemon
+ // close sockets
+ return HostResult.SUCCESS;
+ }
+
+ @Override
+ public BufferedReader getDataBufferedReader() {
+ // return data buffered reader of current selected device
+ return null;
+ }
+
+ @Override
+ public void clear() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public HostResult handleControlMessage(String message) {
+ return HostResult.SUCCESS;
+ }
+
+ public HostResult handleControlMessage(DeviceInfo device, String message) {
+ HostResult result = null;
+ String str = null;
+ Socket controlSock = device.getControlSock();
+ BufferedWriter controlWriter = device.getControlWriter();
+ BufferedReader controlReader = device.getControlReader();
+
+ try {
+ if (null != controlSock && !controlSock.isClosed()) {
+ controlWriter.write(message);
+ controlWriter.flush();
+ }
+
+ System.out.println("wait for ack... [send message : " + message
+ + " ]");
+ while (DACommunicator.isRunning()) {
+ char cbuf[] = new char[64];
+ blocked = true;
+ int readsize = controlReader.read(cbuf);
+ blocked = false;
+ if (readsize > 0) {
+ str = String.copyValueOf(cbuf, 0, readsize);
+ if (null != str && !str.isEmpty()) {
+ result = HostResult.SUCCESS;
+ result.setMessage(str);
+ break;
+ }
+ }
+ }
+ } catch (SocketException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } catch (SocketTimeoutException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ return result;
+ } finally {
+ blocked = false;
+ }
+ return result;
+ }
+
+ private HostResult createControlSocket(DeviceInfo device) {
+ HostResult result = HostResult.SUCCESS;
+ Socket controlSock = null;
+ try {
+ controlSock = new Socket(CommonConstants.LOCAL_HOST,
+ device.getRemotePort());
+ controlSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ controlSock.setReuseAddress(true);
+ controlSock.setTcpNoDelay(true);
+ } catch (UnknownHostException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (SocketException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ }
+
+ if (result.isSuccess()) {
+ device.setControlSock(controlSock);
+ }
+ return result;
+ }
+
+ private HostResult createDataSocket(DeviceInfo device) {
+ HostResult result = HostResult.SUCCESS;
+ Socket dataSock = null;
+ try {
+ dataSock = new Socket(CommonConstants.LOCAL_HOST,
+ device.getRemotePort());
+ dataSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ dataSock.setReuseAddress(true);
+ dataSock.setTcpNoDelay(true);
+ } catch (UnknownHostException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (SocketException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ } catch (IOException e) {
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage(e.getMessage());
+ e.printStackTrace();
+ }
+
+ if (result.isSuccess()) {
+ device.setDataSock(dataSock);
+ }
+ return result;
+ }
+
+ public HostResult getTargetInfo(DeviceInfo device) {
+ String message = CommonConstants.EMPTY
+ + AnalyzerConstants.MSG_TARGET_INFO;
+ System.out.println("Send message :" + message); //$NON-NLS-1$
+
+ HostResult result = handleControlMessage(device, message);
+ if (result.isSuccess()) {
+ System.out.println("target info message ack :"
+ + result.getMessage());
+ // FIXME : log parsing
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_TARGET_INFO_ACK == Integer
+ .parseInt(splitResult[0])) {
+ // TODO : setting target info
+ device.setTargetInfo(new TargetInfo());
+ return result;
+ } else {
+ result = HostResult.ERR_TARGET_INFO_GET_FAIL;
+ result.setMessage(new String(splitResult[0]));
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public HostResult sendKeepAliveMessage(DeviceInfo device) {
+ String message = CommonConstants.EMPTY
+ + AnalyzerConstants.MSG_KEEP_ALIVE;
+ HostResult result = handleControlMessage(device, message);
+ if (result.isSuccess()) {
+ System.out
+ .println("keep alive message ack :" + result.getMessage());
+ // FIXME : log parsing
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_KEEP_ALIVE_ACK == Integer
+ .parseInt(splitResult[0])) {
+ return result;
+ } else {
+ result = HostResult.ERR_TARGET_INFO_GET_FAIL;
+ result.setMessage(new String(splitResult[0]));
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public Socket getDataSocket() {
+ return DACommunicator.getSelectedDevice().getDataSock();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.communicator;
+
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.swap.logparser.MessageParser;
+
+public class DataChannelThread implements Runnable {
+
+ @Override
+ public void run() {
+ MessageParser.getInstance().startMessageParsing(
+ DACommunicator.getDataSocket());
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.communicator;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+
+public class HeartBeatThread implements Runnable {
+ private static int interval = 1000;
+
+ @Override
+ public void run() {
+ List<DeviceInfo> devices = null;
+
+ while (!AnalyzerManager.isExit()) {
+ devices.clear();
+ devices = DACommunicator.getDevices();
+ for (DeviceInfo device : devices) {
+ HostResult result = DACommunicator.sendKeepAliveMessage(device);
+ if (!result.isSuccess()) {
+ System.out.println(result.toString());
+ }
+ if (AnalyzerManager.isExit()) {
+ break;
+ }
+ }
+
+ try {
+ Thread.sleep(interval);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void setInterval(int miliSec) {
+ interval = miliSec;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.swap.logparser;
+
+import java.util.HashMap;
+
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
+
+public class LogPackage {
+ private HashMap<Integer, Logs> logMap;
+
+ public void clear()
+ {
+ getLogMap().clear();
+ }
+
+ public LogPackage() {
+ logMap = new HashMap<Integer, Logs>();
+ }
+
+ private HashMap<Integer, Logs> getLogMap()
+ {
+ if (null == logMap)
+ {
+ logMap = new HashMap<Integer, Logs>();
+ }
+ return logMap;
+ }
+ public boolean isEmpty()
+ {
+ return getLogMap().isEmpty();
+ }
+
+ public void setLogs(int id, LogData input) {
+ Logs logs = getLogMap().get(id);
+ if (null == logs)
+ {
+ logs = new Logs(id);
+ logMap.put(id, logs);
+ }
+ logs.getLogs().add(input);
+ }
+
+ public void setLogs(int id, Logs logs)
+ {
+ if (null != getLogMap().get(id))
+ {
+ logMap.remove(id);
+ }
+ logMap.put(id, logs);
+ }
+
+ public Logs getLogs(int id)
+ {
+ return getLogMap().get(id);
+ }
+
+ public void putLogs(Logs logs)
+ {
+ if (null != logs)
+ {
+ int id = logs.getId();
+ Logs base = getLogMap().get(id);
+ if (null == base)
+ {
+ logMap.put(id, logs);
+ }
+ else
+ {
+ base.getLogs().addAll(logs.getLogs());
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.swap.logparser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
+/** log queue model **/
+public class LogQueue {
+ private static final int FULL_COUNT = 10000;
+ private List<List<LogData>> data = null;
+
+ public LogQueue() {
+ data = new ArrayList<List<LogData>>();
+ }
+
+ public synchronized List<LogData> getFirst() {
+ while (isEmpty()) {
+ try {
+ if (!AnalyzerManager.isRunning()) {
+ return null;
+ }
+ wait();
+ } catch (InterruptedException e) {
+ System.out.println("log queue interrupt!!"); //$NON-NLS-1$
+ continue;
+ }
+ }
+
+ List<LogData> output = data.get(0);
+ data.remove(0);
+ notifyAll();
+ return output;
+ }
+
+ public synchronized void putLog(List<LogData> input) {
+ while (isFull()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ // never reach here!
+ e.printStackTrace();
+ break;
+ }
+ }
+
+ data.add(input);
+ notifyAll();
+ }
+
+ public boolean isEmpty() {
+ if (null == data) {
+ data = new ArrayList<List<LogData>>();
+ }
+ return data.isEmpty();
+ }
+
+ public boolean isFull() {
+ if (size() > FULL_COUNT) {
+ return true;
+ }
+ return false;
+ }
+
+ public int size() {
+ return data.size();
+ }
+
+ public void clear() {
+ data.clear();
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.swap.logparser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
+public class Logs {
+ private List<LogData> logs;
+ int logId;
+
+ public Logs(int id) {
+ logs = new ArrayList<LogData>();
+ logId = id;
+ }
+
+ public int getId() {
+ return logId;
+ }
+
+ // getLogs -> getRawLogs
+ public List<LogData> getLogs() {
+ if (null == logs) {
+ logs = new ArrayList<LogData>();
+ }
+ return logs;
+ }
+
+ public void setLogs(List<LogData> input) {
+ logs = input;
+ }
+
+ public void setLogCenterId(int id) {
+ logId = id;
+ }
+
+ // cloneLogs -> getLogs
+ public List<LogData> getCloneLogs() {
+ List<LogData> newLogs = new ArrayList<LogData>();
+ int size = logs.size();
+ for (int i = 0; i < size; i++) {
+ LogData newLog = logs.get(i).getClone();
+ newLogs.add(newLog);
+ }
+ return newLogs;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.swap.logparser;
+
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.handlers.StopHandler;
+import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+import org.tizen.dynamicanalyzer.swap.model.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe.LogFormat;
+import org.tizen.dynamicanalyzer.swap.model.probe2.BasicDataFactory;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
+import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
+import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.uirecorder.RecordingQueue;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderRecordThread;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.sdblib.service.SyncResult;
+
+public class MessageParser {
+
+ final int MSG_ID_INDEX = 0;
+ final int MSG_LENGTH_INDEX = 1;
+ final int MSG_PAYLOAD_INDEX = 2;
+ final int MSG_SPLIT_SIZE = 3;
+
+ /* Message Buffer max length */
+ final int MSG_BUFFER_MAX = 100;
+ final int MSG_BUFFER_TIMER_DELAY = 5;
+ final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
+ final int WAITING_TIME = 10;
+
+ class AddBufferTimerTask extends TimerTask {
+ private int count = 0;
+
+ @Override
+ public void run() {
+ if (!buffer.isEmpty()) {
+ addBufferToList();
+ count = 0;
+ } else {
+ count++;
+ if (count >= WAITING_TIME) {
+ ToolbarArea.getInstance().stopTrace();
+ }
+ }
+ }
+ }
+
+ private List<LogData> buffer = new ArrayList<LogData>();
+ private Lock lock = new ReentrantLock();
+ private Timer timer = null;
+
+ private static MessageParser receivedMessage = new MessageParser();
+ private int messageCount = 0;
+
+ public static MessageParser getInstance() {
+ return receivedMessage;
+ }
+
+ public void startTimer() {
+ timer = new Timer();
+ timer.scheduleAtFixedRate(new AddBufferTimerTask(),
+ MSG_BUFFER_TIMER_DELAY, MSG_BUFFER_TIMER_PERIOD);
+ }
+
+ public void stopTimer() {
+ if (null != timer) {
+ timer.cancel();
+ timer = null;
+ }
+ }
+
+ private void addBufferToList() {
+ lock.lock();
+ if (null == buffer || 0 == buffer.size()) {
+ lock.unlock();
+ return;
+ }
+ SWAPLogParser.getLogQueue().putLog(buffer);
+ buffer = new ArrayList<LogData>();
+ lock.unlock();
+ }
+
+ private void processAppInfo(String message) {
+// String[] datas = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
+// List<String> appInfo = AnalyzerManager.getProject().getAppInfo();
+// int size = datas.length;
+// for (int i = 0; i < size; i++) {
+// appInfo.set(i, new String(datas[i]));
+// }
+//
+// if (size - 1 < AnalyzerConstants.APP_INFO_BINARY_PATH
+// || null == appInfo.get(AnalyzerConstants.APP_INFO_BINARY_PATH)
+// || appInfo.get(AnalyzerConstants.APP_INFO_BINARY_PATH)
+// .isEmpty()) {
+// ToolbarArea.getInstance().setSourceViewEnable(false);
+// ToolbarArea.getInstance().setSourceViewTooltip(
+// AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
+// } else {
+// ToolbarArea.getInstance().setSourceViewEnable(true);
+// ToolbarArea.getInstance().setSourceViewTooltip(
+// AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);
+// }
+//
+// // User Call Trace : App is Tizen C++ or Tizen native
+// int type = Integer.parseInt(appInfo
+// .get(AnalyzerConstants.APP_INFO_APP_TYPE));
+// if (type == AnalyzerConstants.APP_TYPE_OSP) {
+// SWAPLogParser.setDropCallTraceLog(true);
+// }
+ }
+
+ private String getImageName(String fullPath) {
+ String name = null;
+ name = fullPath
+ .substring(fullPath.lastIndexOf(CommonConstants.SLASH) + 1);
+ return name;
+ }
+
+ private void processRecordLog(final String record) {
+ RecordingQueue rq = UIRecorderRecordThread.getRecordingQueue();
+ rq.putLog(record);
+ }
+
+ private void processImage(final String from) {
+ final String fileName = getImageName(from);
+ final String to = AnalyzerManager.getProject().getSavePath()
+ + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+ + File.separator + fileName;
+
+ new Thread(null, new Runnable() {
+ @Override
+ public void run() {
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && RESULT_OK == res.getCode()) {
+ DACommunicator.removeCommand(from);
+ } else {
+ System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start();
+
+ }
+
+ private void processTerminate() {
+ if (!AnalyzerManager.isExit()) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StopProcessManager.getInstance().stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
+ }
+ });
+ }
+ DACommunicator.setRunning(false);
+ }
+
+ private String message = null;
+ private String[] messages = null;
+
+ private int sentenceIndex = -1;
+ private String sentence = null;
+
+ public void testParsing(byte[] input) {
+ byte[] empty = new byte[1024];
+ byte[] buf = input;
+ BasicDataMessage dataMessage = null;
+ if (null == dataMessage) {
+ dataMessage = new BasicDataMessage();
+ buf = dataMessage.makeData(buf);
+ }
+ // else {
+ // buf = dataMessage.addData(buf);
+ // }
+
+ while (dataMessage.isComplete()) {
+ // dataMessage push to queue
+ processMessage(dataMessage);
+ dataMessage = new BasicDataMessage();
+ buf = dataMessage.makeData(buf);
+ }
+
+ // System.arraycopy(empty, 0, buf, 0, empty.length);
+ }
+
+ public void startMessageParsing(Socket dataSocket) {
+ byte[] empty = new byte[1024];
+ byte[] buf = new byte[1024];
+ BufferedInputStream inputStream = null;
+
+ try {
+ inputStream = new BufferedInputStream(dataSocket.getInputStream());
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ startTimer();
+
+ try {
+ BasicDataMessage dataMessage = null;
+ while (DACommunicator.isRunning()) {
+ int readSize = inputStream.read(buf);
+ if (readSize <= 0) {
+ continue;
+ }
+
+ if (null == dataMessage) {
+ dataMessage = (BasicDataMessage) BasicDataFactory
+ .createBasicDataInstance();
+ buf = dataMessage.makeData(buf);
+ } else {
+ buf = dataMessage.addData(buf);
+ }
+
+ while (dataMessage.isComplete() && DACommunicator.isRunning()) {
+ // dataMessage push to queue
+ processMessage(dataMessage);
+ dataMessage = (BasicDataMessage) BasicDataFactory
+ .createBasicDataInstance();
+ buf = dataMessage.makeData(buf);
+ }
+ } // end while()
+ System.out.println("Receive thread end!!");
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ StopProcessManager.getInstance().stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
+ // timeout
+ }
+ });
+ endingSteps();
+ } catch (IOException e) {
+ System.out
+ .println("### socket timeout - TODO: show this as a dialog."); //$NON-NLS-1$
+
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ StopProcessManager
+ .getInstance()
+ .stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
+ // timeout
+ }
+ });
+ endingSteps();
+ }
+ }
+
+ private void endingSteps() {
+ System.out.println("Ending steps!");
+ message = null;
+ DACommunicator.setRunning(false);
+ AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance().setToolbarState(
+ ToolbarArea.TOOLBAR_STATE_READY);
+ }
+ });
+ stopTimer();
+ addBufferToList();
+ System.out.println("stop log process start");//$NON-NLS-1$
+ StopLogProcessor.runStopLogProcessThread();
+ // DACommunicator.closeSocket();
+ // DACommunicator.unfoward(DACommunicator.LOCAL_PORT,
+ // DACommunicator.getRemotePort());
+ DACommunicator.closeAll();
+ AnalyzerUtil.executeCommand(StopHandler.ID);
+ }
+
+ private void processMessage(BasicDataMessage data) {
+ int messageId = data.getId();
+ LogData log = null;
+ switch (messageId) {
+ case DataChannelConstants.MSG_PROCESS_INFO:
+ // setting process info
+ break;
+ case DataChannelConstants.MSG_TERMINATE:
+ processTerminate();
+ break;
+ case DataChannelConstants.MSG_ERROR:
+ // process error message
+ break;
+ case DataChannelConstants.MSG_SYSTEM:
+ case DataChannelConstants.MSG_RECORD:
+ case DataChannelConstants.MSG_SAMPLE:
+ case DataChannelConstants.MSG_FUNCTION_ENTRY:
+ case DataChannelConstants.MSG_FUNCTION_EXIT:
+ case DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY:
+ case DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT:
+ // make log
+ log = LogDataFactory.createInstance(data);
+ if (null != log) {
+ // push log
+ }
+ break;
+ default: // MSG_PROBE
+ if (messageId > 0x3000 && messageId < 0x4000) {
+ log = LogDataFactory.createInstance(data);
+ if (null != log) {
+ // push log
+ }
+ }
+ }
+ }
+
+ private void parseLog(List<Integer> columnTypes, byte[] payload,
+ List<String> output) {
+ int type = -1;
+ int from = 0;
+ int size = columnTypes.size();
+ for (int i = 0; i < size; i++) {
+ type = columnTypes.get(i);
+ switch (type) {
+ case LogFormat.I:
+ int iv = ByteUtils.toInt(payload, from);
+ output.add(Integer.toString(iv));
+ from += Integer.SIZE / Byte.SIZE;
+ break;
+ case LogFormat.L:
+ long lv = ByteUtils.toLong(payload, from);
+ output.add(Long.toString(lv));
+ from += Long.SIZE / Byte.SIZE;
+ break;
+ case LogFormat.F:
+ float fv = ByteUtils.toFloat(payload, from);
+ output.add(Float.toString(fv));
+ from += Float.SIZE / Byte.SIZE;
+ break;
+ case LogFormat.D:
+ double dv = ByteUtils.toDouble(payload, from);
+ output.add(Double.toString(dv));
+ from += Double.SIZE / Byte.SIZE;
+ break;
+ case LogFormat.S:
+ int to = 0;
+ byte b = -1;
+ for (int ii = from; ii < payload.length; ii++) {
+ b = payload[ii];
+ if (b == 0) {
+ to = ++ii;
+ break;
+ }
+ to = ii;
+ }
+ byte[] str = new byte[to - from];
+ System.arraycopy(payload, from, str, 0, to - from);
+ from = to;
+ output.add(new String(str));
+ break;
+
+ case LogFormat.CL:
+ case LogFormat.CF:
+ // CPU load : float * cpu count
+ // output log ex: "float, float, float" - split char is ","
+ int cpuCount = DACommunicator.getSelectedDevice()
+ .getTargetInfo().getCpuCount();
+ StringBuffer sbuf = new StringBuffer();
+ for (int ii = 0; ii < cpuCount; ii++) {
+ float f = ByteUtils.toFloat(payload, from);
+ sbuf.append(f);
+ from += Float.SIZE / Byte.SIZE;
+ if (ii + 1 != cpuCount) {
+ sbuf.append(',');
+ }
+ }
+ output.add(sbuf.toString());
+ break;
+ case LogFormat.TL:
+ // Thread load : (int pid, float load) * thread count
+ case LogFormat.PL:
+ // Process load : (int pid, float load) * process count
+ int backPos = from - Integer.SIZE / Byte.SIZE;
+ int count = ByteUtils.toInt(payload, backPos);
+ StringBuffer outBuf = new StringBuffer();
+ for (int ii = 0; ii < count; ii++) {
+ int tid = ByteUtils.toInt(payload, from);
+ from += Integer.SIZE / Byte.SIZE;
+ outBuf.append(tid).append('|');
+ float f = ByteUtils.toFloat(payload, from);
+ outBuf.append(f);
+ from += Float.SIZE / Byte.SIZE;
+ if (ii + 1 != count) {
+ outBuf.append(',');
+ }
+ }
+ output.add(outBuf.toString());
+ break;
+ case LogFormat.A:
+ int countOfArgs = ByteUtils.toInt(payload, from);
+ from += Integer.SIZE / Byte.SIZE;
+ StringBuffer buf = new StringBuffer();
+ for (int ii = 0; ii < countOfArgs; ii++) {
+ char c = (char) payload[from];
+ from += 1;
+ switch (c) {
+ case 'c':
+ buf.append((payload[from]));
+ from += 1;
+ break;
+ case 'd':
+ int iValue = ByteUtils.toInt(payload, from);
+ buf.append(iValue);
+ from += Integer.SIZE / Byte.SIZE;
+ break;
+ case 'x':
+ long lValue = ByteUtils.toLong(payload, from);
+ buf.append(lValue);
+ from += Long.SIZE / Byte.SIZE;
+ break;
+ case 'p':
+ long pValue = ByteUtils.toLong(payload, from);
+ buf.append(Long.toHexString(pValue));
+ from += Long.SIZE / Byte.SIZE;
+ break;
+ case 'f':
+ float fValue = ByteUtils.toFloat(payload, from);
+ buf.append(fValue);
+ from += Float.SIZE / Byte.SIZE;
+ break;
+ case 'w':
+ double dValue = ByteUtils.toDouble(payload, from);
+ buf.append(dValue);
+ from += Double.SIZE / Byte.SIZE;
+ break;
+ case 's':
+ for (int iii = from; iii < payload.length; iii++) {
+ if (payload[iii] != 0) {
+ buf.append((char) payload[iii]);
+ } else {
+ from = iii + 1;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if (ii + 1 != countOfArgs) {
+ buf.append(',');
+ }
+ }
+ output.add(buf.toString());
+ case LogFormat.T:
+ // not used for log parsing
+ break;
+ default:
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.swap.logparser;
+
+import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
+
+import java.io.File;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.SymbolManager;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.logparser.LogInserter;
+import org.tizen.dynamicanalyzer.model.ImageInfo;
+import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
+import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.MemoryData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ScreenShotData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
+import org.tizen.dynamicanalyzer.ui.page.BaseView;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderPlayThread;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.ImageUtil;
+import org.tizen.sdblib.service.SyncResult;
+
+public class SWAPLogParser implements Runnable {
+ private final String OSP_MAIN = "OspMain"; //$NON-NLS-1$
+ private final String TIME_POST_FIX = "00";//$NON-NLS-1$
+ private static Thread logParser = null;
+ private static boolean dropCallTraceLog = false;
+ private static LogQueue logQueue = null;
+
+ private static boolean isLogParsingComplete = false;
+
+ private int SMALL_IMG_WIDTH = 40;
+ private int SMALL_IMG_HEIGHT = 66;
+
+ private int DEFAULT_IMG_WIDTH = 480;
+ private int DEFAULT_IMG_HEIGHT = 800;
+
+ /** thread **/
+ private int pid = -1;
+
+ public static void clear() {
+ stopLogParser();
+ getLogQueue().clear();
+ isLogParsingComplete = false;
+ }
+
+ public static LogQueue getLogQueue() {
+ if (null == logQueue) {
+ logQueue = new LogQueue();
+ }
+ return logQueue;
+ }
+
+ public static void setDropCallTraceLog(boolean drop) {
+ dropCallTraceLog = drop;
+ }
+
+ public static boolean isDrapCallTraceLog() {
+ return dropCallTraceLog;
+ }
+
+ public static boolean isLogParsingComplete() {
+ return isLogParsingComplete;
+ }
+
+ public static void setLogParsingComplete(boolean complete) {
+ isLogParsingComplete = complete;
+ }
+
+ public static void startLogParser() {
+ if (null == logParser || !logParser.isAlive()) {
+ logParser = new Thread(null, new SWAPLogParser(),
+ AnalyzerConstants.LOG_QUEUE_OBSERVING_THREAD);
+ logParser.start();
+ }
+ }
+
+ public static void stopLogParser() {
+ if (null != logParser && logParser.isAlive()) {
+ LogQueue logQueue = getLogQueue();
+ synchronized (logQueue) {
+ logQueue.notifyAll();
+ }
+ try {
+ System.out.println("wait for log parser join");//$NON-NLS-1$
+ logParser.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /*** log parsing thread ***/
+ @Override
+ public void run() {
+ isLogParsingComplete = false;
+ LogQueue logQueue = getLogQueue();
+ while (!AnalyzerManager.isExit()) {
+ List<LogData> logs = logQueue.getFirst();
+ if (null == logs) {
+ break;
+ }
+ logSlicing(logs);
+ }
+
+ /* log for debug */
+ System.out.println("log parsing thread end!!"); //$NON-NLS-1$
+ isLogParsingComplete = true;
+
+ if (!AnalyzerManager.isExit()) {
+ ToolbarArea.getInstance().stopTimer();
+ }
+ }
+
+ private void logSlicing(List<LogData> logLumb) {
+ // String[] slicedLog = null;
+ Project project = AnalyzerManager.getProject();
+
+ int size = logLumb.size();
+ LogPackage logPack = new LogPackage();
+
+ for (int i = 0; i < size; i++) {
+ if (null == logLumb.get(i)) {
+ continue;
+ }
+ // String[] log = logLumb.get(i).split(CommonConstants.NEW_LINE);
+ //
+ // slicedLog = log[0].split(AnalyzerConstants.DATA_PARSING_TOKEN);
+ //
+ // BasicDataMessage22 bdi = (BasicDataMessage22)
+ // BasicDataFactory.createBasicDataInstance();
+ // bdi.makeData(slicedLog);
+ // LogData basicData = LogDataFactory.createInstance(bdi);
+ // logId = slicedLog[LogCenterConstants.ID_INDEX];
+ // int id = Integer.parseInt(logId);
+ // int id = commonData.getId();
+
+ LogData log = logLumb.get(i);
+ int id = log.getId();
+
+ // check main process!!
+ // TODO : multi process processing
+ if (log instanceof ProbeCommonData) {
+ if (-1 == pid) {
+ pid = ((ProbeCommonData) log).getPid();
+ } else {
+ int p = ((ProbeCommonData) log).getPid();
+ if (pid != p) {
+ continue;
+ }
+ }
+ }
+
+ // set start time
+ long longTime = log.getTime();
+ long startTime = project.getStartTime();
+
+ if (0 == startTime) {
+ startTime = longTime;
+ project.setStartTime(startTime);
+ }
+ long lastTime = longTime - startTime;
+ // String modifyedTime = Long.toString(lastTime) + TIME_POST_FIX;
+ log.setTime(lastTime);
+ // slicedLog[timeIndex] = modifyedTime;
+
+ // String seq = slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
+ // long seqNum = Long.parseLong(seq);
+ int seqNum = log.getSeq();
+
+ if (log instanceof ProfileData) {
+ // String apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
+ // if (apiName.isEmpty() || apiName.equals("_end")) { //$NON-NLS-1$
+ // setFuncName(slicedLog);
+ // }
+ //
+ // if (LogParser.isDrapCallTraceLog()) {
+ // apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
+ // if (!apiName.equals(OSP_MAIN)) {
+ // continue;
+ // }
+ // LogParser.setDropCallTraceLog(false);
+ // }
+
+ // String start =
+ // slicedLog[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_START_INDEX];
+ // String end =
+ // slicedLog[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_END_INDEX];
+ // if (!start.isEmpty() && !end.isEmpty()
+ // && !AnalyzerManager.isBinStartEndSet()) {
+ // AnalyzerManager.setBinaryStartEndAddr(start, end);
+ // }
+ //
+ // if
+ // (AnalyzerManager.getCallstackManager().isIrregularUserCall(
+ // slicedLog)) {
+ // continue;
+ // }
+ pushLog(log, logPack);
+ /* TODO: user callstack create by entry and exit */
+ // AnalyzerManager.getCallstackManager().makeUserCallstack(
+ // slicedLog,
+ // FunctionUsageProfiler.getInstance()
+ // .getProfileDataMaker());
+ } else if (log instanceof SystemData) {
+ if (seqNum == 1) {
+ UIRecorderPlayThread rp = UIRecorderTool.getInstance()
+ .getPlayThead();
+ if (null != rp && rp.isAlive()) {
+ UIRecorderTool.getInstance().getPlayThead().interrupt();
+ }
+ }
+ pushLog(log, logPack);
+ } else {
+ if (log instanceof ScreenShotData) {
+ String remoteImgPath = ((ScreenShotData) log)
+ .getImageFilePath();
+ int rotate = ((ScreenShotData) log).getOrientation();
+ processImage(remoteImgPath, rotate);
+ }
+ pushLog(log, logPack);
+ // TODO : callstack
+ // AnalyzerManager.getCallstackManager()
+ // .makeCallstackWithoutBacktrace(slicedLog);
+ if (log instanceof FileData || log instanceof MemoryData) {
+ // TODO: leak detect
+ // AnalyzerManager.getLeakDetector().runLeakDectect(log);
+ }
+
+ // TODO: failed check
+ // AnalyzerManager.getFailedChecker().check(slicedLog,
+ // AnalyzerManager.getCallstackManager());
+ }
+
+ // set last log number
+ AnalyzerManager.getProject().setLastLogNum(seqNum, id);
+ }
+ updateLog(logPack);
+ }
+
+ private void processImage(final String from, final int angle) {
+ final String fileName = getImageName(from);
+ final String to = AnalyzerManager.getProject().getSavePath()
+ + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+ + File.separator + fileName;
+ if (angle != 0) {
+ System.out.println("[ image rotate : " + angle + " ]");
+ }
+
+ new Thread(null, new Runnable() {
+ int count = 0;
+
+ @Override
+ public void run() {
+ while (true && count < 5) {
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && RESULT_OK == res.getCode()) {
+ DACommunicator.removeCommand(from);
+ /* image resizing */
+ String smallImagePath = AnalyzerManager.getProject()
+ .getSavePath()
+ + File.separator
+ + AnalyzerConstants.IMAGE_FOLDER_NAME
+ + File.separator
+ + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
+ + File.separator + fileName;
+ ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH,
+ DEFAULT_IMG_HEIGHT, angle);
+ if (angle == 90 || angle == 270) {
+ ImageUtil.resize(to, smallImagePath,
+ SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH);
+ } else {
+ ImageUtil.resize(to, smallImagePath,
+ SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT);
+ }
+
+ break;
+ } else {
+ System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ Thread.sleep(1000);
+ count++;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start();
+
+ }
+
+ private String getImageName(String fullPath) {
+ String name = null;
+ name = fullPath
+ .substring(fullPath.lastIndexOf(CommonConstants.SLASH) + 1);
+ return name;
+ }
+
+ private void updateLog(LogPackage logPack) {
+ if (null == logPack || logPack.isEmpty()) {
+ return;
+ }
+
+ /* 1. InsertLog extension */
+ // TODO: push log
+ // LogInserter.getInsertLogQueue().push(logPack);
+ LogInserter.startInsertLogThread();
+
+ BaseView bv = (BaseView) AnalyzerUtil.getViewPart(BaseView.ID);
+ // TODO: update log
+ // bv.getMainTab().updateLog(logPack);
+ }
+
+ private void setFuncName(String[] input) {
+ boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
+ String path = AnalyzerManager.getProject().getBinaryPath();
+ String pcAddr = input[LogCenterConstants.PCADDR_INDEX];
+ String functionName = SymbolManager.addr2func(path, pcAddr, isPieBuild,
+ baseAddr);
+ if (null == functionName || functionName.isEmpty()
+ || functionName.equals("_end")) { //$NON-NLS-1$
+ functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+ } else {
+ String prevFunctionName = functionName;
+ functionName = SymbolManager
+ .demanglingFunctionName(prevFunctionName);
+ }
+
+ input[LogCenterConstants.APINAME_INDEX] = functionName;
+ }
+
+ private void pushLog(LogData logData, LogPackage logPack) {
+ if (logData instanceof ScreenShotData) {
+ ImageInfo imgInfo = new ImageInfo();
+ imgInfo.setSeq(Integer.toString(logData.getSeq()));
+ imgInfo.setTime(Long.toString(logData.getTime()));
+ AnalyzerManager.getImageSet().put(imgInfo.getSeq(), imgInfo);
+ }
+ logPack.setLogs(logData.getId(), logData);
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class ByteUtils {
+ public static byte EOS = '\0';
+
+ /**
+ * String to byte
+ *
+ * ByteUtils.toByte("1", *) = 0x01 ByteUtils.toByte("-1", *) = 0xff
+ *
+ * @param value
+ * @param defaultValue
+ * @return
+ */
+ public static byte toByte(String value, byte defaultValue) {
+ try {
+ return Byte.parseByte(value);
+ } catch (Exception e) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * * 입력한 바이트 배열(4바이트)을 int 형으로 변환한다.
+ *
+ * @param src
+ * @param srcPos
+ * @return
+ */
+ public static int toInt(byte[] src, int srcPos) {
+ int dword = 0;
+ for (int i = 0; i < 4; i++) {
+ dword = (dword << 8) + (src[i + srcPos] & 0xFF);
+ }
+ return dword;
+ }
+
+ /**
+ * 입력한 바이트 배열(4바이트)을 int 형으로 변환한다.
+ *
+ * @param src
+ * @return
+ */
+ public static int toInt(byte[] src) {
+ return toInt(src, 0);
+ }
+
+ /**
+ * 입력한 바이트 배열(8바이트)을 long 형으로 변환한다.
+ *
+ * @param src
+ * @param srcPos
+ * @return
+ */
+ public static long toLong(byte[] src, int srcPos) {
+ long qword = 0;
+ for (int i = 0; i < 8; i++) {
+ qword = (qword << 8) + (src[i + srcPos] & 0xFF);
+ }
+ return qword;
+ }
+
+ /**
+ * 입력한 바이트 배열(8바이트)을 long 형으로 변환한다.
+ *
+ * @param src
+ * @return
+ */
+ public static long toLong(byte[] src) {
+ return toLong(src, 0);
+ }
+
+ /**
+ * int 형의 값을 바이트 배열(4바이트)로 변환한다.
+ *
+ * @param value
+ * @param dest
+ * @param destPos
+ */
+ public static void toBytes(int value, byte[] dest, int destPos) {
+ for (int i = 0; i < 4; i++) {
+ dest[i + destPos] = (byte) (value >> ((7 - i) * 8));
+ }
+ }
+
+ /**
+ * int 형의 값을 바이트 배열(4바이트)로 변환한다.
+ *
+ * @param value
+ * @return
+ */
+ public static byte[] toBytes(int value) {
+ byte[] dest = new byte[4];
+ toBytes(value, dest, 0);
+ return dest;
+ }
+
+ /**
+ * long 형의 값을 바이트 배열(8바이트)로 변환한다.
+ *
+ * @param value
+ * @param dest
+ * @param destPos
+ */
+ public static void toBytes(long value, byte[] dest, int destPos) {
+ for (int i = 0; i < 8; i++) {
+ dest[i + destPos] = (byte) (value >> ((7 - i) * 8));
+ }
+ }
+
+ /**
+ * long 형의 값을 바이트 배열(8바이트)로 변환한다.
+ *
+ * @param value
+ * @return
+ */
+ public static byte[] toBytes(long value) {
+ byte[] dest = new byte[8];
+ toBytes(value, dest, 0);
+ return dest;
+ }
+
+ /**
+ * 8, 10, 16진수 문자열을 바이트 배열로 변환한다. 8, 10진수인 경우는 문자열의 3자리가, 16진수인 * 경우는 2자리가,
+ * 하나의 byte로 바뀐다.
+ *
+ * ByteUtils.toBytes(null) = null ByteUtils.toBytes("0E1F4E", 16) = [0x0e,
+ * 0xf4, 0x4e] ByteUtils.toBytes("48414e", 16) = [0x48, 0x41, 0x4e]
+ *
+ * @param digits
+ * 문자열
+ * @param radix
+ * 진수(8, 10, 16만 가능)
+ * @return
+ * @throws NumberFormatException
+ */
+ public static byte[] toBytes(String digits, int radix)
+ throws IllegalArgumentException, NumberFormatException {
+ if (digits == null) {
+ return null;
+ }
+ if (radix != 16 && radix != 10 && radix != 8) {
+ throw new IllegalArgumentException("For input radix: \"" + radix
+ + "\"");
+ }
+ int divLen = (radix == 16) ? 2 : 3;
+ int length = digits.length();
+ if (length % divLen == 1) {
+ throw new IllegalArgumentException("For input string: \"" + digits
+ + "\"");
+ }
+ length = length / divLen;
+ byte[] bytes = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int index = i * divLen;
+ bytes[i] = (byte) (Short.parseShort(
+ digits.substring(index, index + divLen), radix));
+ }
+ return bytes;
+ }
+
+ /**
+ * 16진수 문자열을 바이트 배열로 변환한다. 문자열의 2자리가 하나의 byte로 바뀐다.
+ * ByteUtils.hexStringToBytes(null) = null
+ * ByteUtils.hexStringToBytes("0E1F4E") = [0x0e, 0xf4, 0x4e]
+ * ByteUtils.hexStringToBytes("48414e") = [0x48, 0x41, 0x4e]
+ *
+ * @param digits
+ * 16진수 문자열
+ * @return
+ * @throws NumberFormatException
+ */
+ public static byte[] hexStringToBytes(String digits)
+ throws IllegalArgumentException, NumberFormatException {
+ if (digits == null) {
+ return null;
+ }
+ int length = digits.length();
+ if (length % 2 == 1) {
+ throw new IllegalArgumentException("For input string: \"" + digits
+ + "\"");
+ }
+ length = length / 2;
+ byte[] bytes = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int index = i * 2;
+ bytes[i] = (byte) (Short.parseShort(
+ digits.substring(index, index + 2), 16));
+ }
+ return bytes;
+ }
+
+ public static byte[] stringToByte(String str) {
+ if (str.isEmpty()) {
+ byte temp[] = new byte[1];
+ temp[0] = EOS;
+ return temp;
+ }
+
+ int size = str.length();
+ byte[] temp = null;
+ if (EOS != str.charAt(size - 1)) {
+ temp = new byte[size + 1];
+ System.arraycopy(str.getBytes(), 0, temp, 0, str.getBytes().length);
+ temp[temp.length - 1] = EOS;
+ } else {
+ temp = new byte[size];
+ System.arraycopy(str.getBytes(), 0, temp, 0, str.getBytes().length);
+ }
+ return temp;
+ }
+
+ public static byte[] shortToBytes(short input) {
+ int size = Short.SIZE / Byte.SIZE;
+ return ByteBuffer.allocate(size).putShort(input).array();
+ }
+
+ public static short byteToShort(byte[] input, int from) {
+ int size = Short.SIZE / Byte.SIZE;
+ byte[] temp = new byte[size];
+ System.arraycopy(input, from, temp, 0, size);
+ ByteBuffer buf = ByteBuffer.wrap(temp);
+ return buf.getShort();
+ }
+
+ public static byte[] floatToBytes(float input) {
+ int size = Float.SIZE / Byte.SIZE;
+ return ByteBuffer.allocate(size).putFloat(input).array();
+ }
+
+ public static byte[] doubleToBytes(double input) {
+ int size = Double.SIZE / Byte.SIZE;
+ return ByteBuffer.allocate(size).putDouble(input).array();
+ }
+
+ public static float toFloat(byte[] input, int from) {
+ int size = Float.SIZE / Byte.SIZE;
+ byte[] temp = new byte[size];
+ System.arraycopy(input, from, temp, 0, size);
+ ByteBuffer buf = ByteBuffer.wrap(temp);
+ return buf.getFloat();
+ }
+
+ public static double toDouble(byte[] input, int from) {
+ int size = Double.SIZE / Byte.SIZE;
+ byte[] temp = new byte[size];
+ System.arraycopy(input, from, temp, 0, size);
+ ByteBuffer buf = ByteBuffer.wrap(temp);
+ return buf.getDouble();
+ }
+
+ public static byte[] concatByteArray(byte[] front, byte[] rear) {
+ if (null == front && null == rear) {
+ return null;
+ } else if (null == front && null != rear) {
+ return rear;
+ } else if (null != front && null == rear) {
+ return front;
+ }
+
+ byte[] result = new byte[front.length + rear.length];
+ System.arraycopy(front, 0, result, 0, front.length);
+ System.arraycopy(rear, 0, result, front.length, rear.length);
+
+ return result;
+ }
+
+ public static byte[] concatByteArray(final Object... byteArrays) {
+ if (null == byteArrays) {
+ return null;
+ }
+ byte[] temp = new byte[0];
+ for (Object obj : byteArrays) {
+ if (null == obj) {
+ continue;
+ }
+ if (obj instanceof byte[]) {
+ temp = concatByteArray(temp, (byte[]) obj);
+ }
+ }
+ return temp;
+ }
+
+ public static byte[] getByte(final Object... objects) {
+ if (null == objects) {
+ return null;
+ }
+ byte[] temp = new byte[0];
+ for (Object obj : objects) {
+ if (null == obj) {
+ continue;
+ }
+
+ if (obj instanceof Integer) {
+ int value = (Integer) obj;
+ temp = ByteUtils
+ .concatByteArray(temp, ByteUtils.toBytes(value));
+ } else if (obj instanceof Long) {
+ long value = (Long) obj;
+ temp = ByteUtils
+ .concatByteArray(temp, ByteUtils.toBytes(value));
+ } else if (obj instanceof Float) {
+ float f = (Float) obj;
+ temp = ByteUtils.concatByteArray(temp,
+ ByteUtils.floatToBytes(f));
+ } else if (obj instanceof String) {
+ String value = (String) obj;
+ temp = ByteUtils.concatByteArray(temp,
+ ByteUtils.stringToByte(value));
+ } else if (obj instanceof byte[]) {
+ temp = ByteUtils.concatByteArray(temp, (byte[]) obj);
+ } else if (obj instanceof List<?>) {
+ List<?> a = (List<?>) obj;
+ temp = ByteUtils.concatByteArray(temp,
+ getByteFromList((List<Object>) obj));
+ } else {
+ continue;
+ }
+ }
+ return temp;
+ }
+
+ public static <T> byte[] getByteFromList(List<T> input) {
+ byte[] temp = new byte[0];
+ for (T obj : input) {
+ if (obj instanceof SWAPModel) {
+ temp = ByteUtils.concatByteArray(temp,
+ ((SWAPModel) obj).getByteValue());
+ } else {
+ temp = ByteUtils.concatByteArray(temp, obj);
+ }
+ }
+ return temp;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model;
+
+public interface SWAPModel {
+ public byte[] getByteValue();
+
+ public void setByteToValues(byte[] input);
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+
+public class ApplicationInfo implements SWAPModel{
+ private String appId = null;
+ private String execPath = null;
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ public String getExecPath() {
+ return execPath;
+ }
+
+ public void setExecPath(String execPath) {
+ this.execPath = execPath;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.concatByteArray(ByteUtils.stringToByte(appId),
+ ByteUtils.stringToByte(execPath));
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class ApplicationInst implements SWAPModel {
+ // path of binary
+ private String path = null;
+
+ // count of functions
+ private int funcCount = 0;
+
+ // FunctionInst list
+ private List<FunctionInst> funcInstList = null;
+
+ // count of library
+ private int libCount = 0;
+
+ // LibararyInst list
+ private List<LibraryInst> libInstList = null;
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public int getFuncCount() {
+ return funcCount;
+ }
+
+ public void setFuncCount(int funcCount) {
+ this.funcCount = funcCount;
+ }
+
+ public List<FunctionInst> getFuncInstList() {
+ return funcInstList;
+ }
+
+ public void setFuncInstList(List<FunctionInst> funcInstList) {
+ this.funcInstList = funcInstList;
+ }
+
+ public int getLibCount() {
+ return libCount;
+ }
+
+ public void setLibCount(int libCount) {
+ this.libCount = libCount;
+ }
+
+ public List<LibraryInst> getLibInstList() {
+ return libInstList;
+ }
+
+ public void setLibInstList(List<LibraryInst> libInstList) {
+ this.libInstList = libInstList;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(path, funcCount, funcInstList, libCount,
+ libInstList);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class BasicMessage implements SWAPModel {
+ private int id = 0;
+ private int length = 0;
+ private byte[] payload = null;
+
+ public BasicMessage(int id, int length, byte[] payload) {
+ this.id = id;
+ this.length = length;
+ this.payload = payload;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public byte[] getPayload() {
+ return payload;
+ }
+
+ public void setPayload(byte[] payload) {
+ this.payload = payload;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(id, length, payload);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class BinaryInfo implements SWAPModel {
+ private int type = 0;
+ private String path = null;
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.concatByteArray(type, path);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class EventObject implements SWAPModel {
+ public static final int TOUCH = 0x8001;
+ public static final int KEY = 0x8002;
+
+ private long time = 0;
+ private int id = 0;
+ private int type = 0;
+ private int code = 0;
+ private int value = 0;
+
+ public long getTime() {
+ return time;
+ }
+
+ public void setTime(long time) {
+ this.time = time;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(time, id, type, code, value);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class FunctionInst implements SWAPModel {
+ // function address
+ private long addr = 0;
+
+ // count of args
+ private int argCount = 0;
+
+ // args
+ private String args = null;
+
+ public long getAddr() {
+ return addr;
+ }
+
+ public void setAddr(long addr) {
+ this.addr = addr;
+ }
+
+ public int getArgCount() {
+ return argCount;
+ }
+
+ public void setArgCount(int argCount) {
+ this.argCount = argCount;
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public void setArgs(String args) {
+ this.args = args;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(addr, argCount, args);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class LibraryInst implements SWAPModel {
+ // path of binary
+ private String path = null;
+
+ // count of functions
+ private int count = 0;
+
+ // FunctionInst List
+ private List<FunctionInst> funcInstList = null;
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public List<FunctionInst> getFuncInstList() {
+ return funcInstList;
+ }
+
+ public void setFuncInstList(List<FunctionInst> funcInstList) {
+ this.funcInstList = funcInstList;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(path, count, funcInstList);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class ReplayEvent implements SWAPModel {
+ private int enabled = 0;
+ private long time = 0;
+ private int objectCount = 0;
+ private List<EventObject> eventObjectList = null;
+
+ public int getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(int enabled) {
+ this.enabled = enabled;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ public void setTime(long time) {
+ this.time = time;
+ }
+
+ public int getObjectCount() {
+ return objectCount;
+ }
+
+ public void setObjectCount(int objectCount) {
+ this.objectCount = objectCount;
+ }
+
+ public List<EventObject> getEventObjects() {
+ if (null == eventObjectList) {
+ eventObjectList = new ArrayList<EventObject>();
+ }
+ return eventObjectList;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(enabled, time, objectCount, eventObjectList);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class RunTimeConfiguration implements SWAPModel {
+ private int features = 0;
+ private int systemTraceInterval = 1000;
+ private int dataMessageInterval = 1000;
+
+ public int getFeatures() {
+ return features;
+ }
+
+ public void setFeatures(int features) {
+ this.features = features;
+ }
+
+ public int getSystemTraceInterval() {
+ return systemTraceInterval;
+ }
+
+ public void setSystemTraceInterval(int systemTraceInterval) {
+ this.systemTraceInterval = systemTraceInterval;
+ }
+
+ public int getDataMessageInterval() {
+ return dataMessageInterval;
+ }
+
+ public void setDataMessageInterval(int dataMessageInterval) {
+ this.dataMessageInterval = dataMessageInterval;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(features, systemTraceInterval,
+ dataMessageInterval);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+
+public class TargetInfo {
+ private long systemMemorySize = 0;
+ private long storageSize = 0;
+ private int bluetoothSupport = -1;
+ private int gpsSupport = -1;
+ private int wifiSupport = -1;
+ private int cameraCount = 0;
+ private String networkType = null;
+ private int maxBrightness = 0;
+ private int cpuCount = 0;
+
+ public long getSystemMemorySize() {
+ return systemMemorySize;
+ }
+
+ public void setSystemMemorySize(long systemMemorySize) {
+ this.systemMemorySize = systemMemorySize;
+ }
+
+ public long getStorageSize() {
+ return storageSize;
+ }
+
+ public void setStorageSize(long storageSize) {
+ this.storageSize = storageSize;
+ }
+
+ public int getBluetoothSupport() {
+ return bluetoothSupport;
+ }
+
+ public void setBluetoothSupport(int bluetoothSupport) {
+ this.bluetoothSupport = bluetoothSupport;
+ }
+
+ public int getGpsSupport() {
+ return gpsSupport;
+ }
+
+ public void setGpsSupport(int gpsSupport) {
+ this.gpsSupport = gpsSupport;
+ }
+
+ public int getWifiSupport() {
+ return wifiSupport;
+ }
+
+ public void setWifiSupport(int wifiSupport) {
+ this.wifiSupport = wifiSupport;
+ }
+
+ public int getCameraCount() {
+ return cameraCount;
+ }
+
+ public void setCameraCount(int cameraCount) {
+ this.cameraCount = cameraCount;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public int getMaxBrightness() {
+ return maxBrightness;
+ }
+
+ public void setMaxBrightness(int maxBrightness) {
+ this.maxBrightness = maxBrightness;
+ }
+
+ public int getCpuCount() {
+ return cpuCount;
+ }
+
+ public void setCpuCount(int cpuCount) {
+ this.cpuCount = cpuCount;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.control;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
+
+public class UserSpaceInst implements SWAPModel {
+ // count of applications
+ private int count = 0;
+ private List<ApplicationInst> appInstList = null;
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public List<ApplicationInst> getAppInstList() {
+ return appInstList;
+ }
+
+ public void setAppInstList(List<ApplicationInst> appInstList) {
+ this.appInstList = appInstList;
+ }
+
+ @Override
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(count, appInstList);
+ }
+
+ @Override
+ public void setByteToValues(byte[] input) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ApiNameManager {
+ private static List<String> apiList = new ArrayList<String>();
+
+ public static String getApiName(int apiId) {
+ return apiList.get(apiId);
+ }
+
+ public static int getApiId(String name) {
+ if (apiList.indexOf(name) < 0) {
+ apiList.add(name);
+ }
+ return apiList.indexOf(name);
+ }
+
+ public static List<String> getApiList() {
+ return apiList;
+ }
+
+ public static void clear() {
+ apiList.clear();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.probe2.BasicDataInterface;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+
+public class BasicDataMessage implements BasicDataInterface {
+ public static final int INT_SIZE = CommonConstants.INT_SIZE;
+ public static final int ID_SIZE = INT_SIZE;
+ public static final int SEQ_SIZE = INT_SIZE;
+ public static final int TIME_SIZE = CommonConstants.LONG_SIZE;
+ public static final int PAYLOAD_LENGTH_SIZE = INT_SIZE;
+
+ public static final int HEADER_SIZE = ID_SIZE + SEQ_SIZE + TIME_SIZE
+ + PAYLOAD_LENGTH_SIZE;
+
+ protected int id = -1;
+ protected int seq = -1;
+ protected long time = -1;
+ protected int payloadSize = 0;
+ protected byte[] payload = null;
+ protected boolean complete = false;
+ protected String callstackLog = null;
+
+ private int reqSize = 0;
+ private byte[] headerBuffer = new byte[HEADER_SIZE];
+ private byte[] emptyHeaderBuffer = new byte[HEADER_SIZE];
+
+ private byte[] emptyBuffer = null;
+ private int bufferStart = 0;
+
+ public byte[] makeData(byte[] input) {
+
+ if (null == input || input.length <= 0) {
+ return input;
+ }
+ bufferStart = 0;
+ // header is parsing?
+ if (id < 0) { // header is not parsing
+ if (reqSize == 0) {
+ reqSize = HEADER_SIZE;
+ }
+
+ int copySize = (reqSize < input.length) ? reqSize : input.length;
+ System.arraycopy(input, 0, headerBuffer, HEADER_SIZE - reqSize,
+ copySize);
+ if (input.length < reqSize) {
+ reqSize = reqSize - input.length;
+ return new byte[0];
+ } else {
+ bufferStart = reqSize;
+ reqSize = 0;
+ }
+ // parsing header
+ id = ByteUtils.toInt(headerBuffer);
+ seq = ByteUtils.toInt(headerBuffer, ID_SIZE);
+ time = ByteUtils.toLong(headerBuffer, ID_SIZE + SEQ_SIZE);
+ // FIXME : make to micro sec
+ time *= 100;
+ payloadSize = ByteUtils.toInt(headerBuffer, ID_SIZE + SEQ_SIZE
+ + TIME_SIZE);
+ // clear headerBuffer
+ System.arraycopy(emptyHeaderBuffer, 0, headerBuffer, 0, HEADER_SIZE);
+ // input - headerBuffer = buffer
+ payload = new byte[payloadSize];
+ }
+
+ reqSize = (0 == reqSize) ? payloadSize : reqSize;
+
+ int cpSize = (input.length - bufferStart > reqSize) ? reqSize
+ : input.length - bufferStart;
+ int retIndex = bufferStart + reqSize;
+ System.arraycopy(input, bufferStart, payload, payloadSize - reqSize,
+ cpSize);
+ if (reqSize > cpSize) {
+ reqSize = reqSize - cpSize;
+ return new byte[0];
+ } else {
+ byte[] ret = new byte[input.length - retIndex];
+ System.arraycopy(input, retIndex, ret, 0, input.length - retIndex);
+ complete = (payloadSize == payload.length) ? true : false;
+ return ret;
+ }
+ }
+
+ public byte[] addData(byte[] input) {
+ int remainSize = (payloadSize - payload.length > 0) ? payloadSize
+ - payload.length : DataChannelConstants.BUFFER_SIZE;
+
+ System.arraycopy(input, 0, payload, payload.length, remainSize);
+ byte[] ret = (remainSize == DataChannelConstants.BUFFER_SIZE) ? null
+ : new byte[input.length - remainSize];
+ if (null != ret) {
+ System.arraycopy(input, remainSize, ret, 0, input.length
+ - remainSize);
+ }
+ complete = (payloadSize == payload.length) ? true : false;
+ return ret;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getSeq() {
+ return seq;
+ }
+
+ public void setSeq(int seq) {
+ this.seq = seq;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ public void setTime(long time) {
+ this.time = time;
+ }
+
+ public int getPayloadSize() {
+ return payloadSize;
+ }
+
+ public void setPayloadSize(int payloadSize) {
+ this.payloadSize = payloadSize;
+ }
+
+ public byte[] getPayload() {
+ return payload;
+ }
+
+ public void setPayload(byte[] payload) {
+ this.payload = payload;
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ @Override
+ public String[] getLog() {
+ // Unused, for version 2.2
+ return null;
+ }
+
+ @Override
+ public BasicDataInterface getClone() {
+ BasicDataMessage clone = new BasicDataMessage();
+ clone.id = this.id;
+ clone.seq = this.seq;
+ clone.time = this.time;
+ clone.payload = this.payload;
+ return clone;
+ }
+
+ public void makeData(String[] input) {
+ id = Integer.parseInt(input[LogCenterConstants.ID_INDEX]);
+ id = mappingId(id);
+ seq = Integer.parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
+ time = Long.parseLong(input[LogCenterConstants.TIME_INDEX]);
+
+ int size = LogDataFactory.getLogColumnCountbyId(id);
+ String[] newInput = new String[size];
+ for (int i = 0; i < size; i++) {
+ newInput[i] = CommonConstants.EMPTY;
+ }
+ System.arraycopy(input, 0, newInput, 0, input.length);
+ input = null;
+ payload = AnalyzerUtil.makeByteArray(id, newInput);
+ payloadSize = payload.length;
+ }
+
+ private static int mappingId(int oldId) {
+ int newId = -1;
+ switch (oldId) {
+ case LogCenterConstants.LOG_MEMORY:
+ newId = AnalyzerConstants.MSG_PROBE_MEMORY;
+ break;
+ case LogCenterConstants.LOG_CONTROL:
+ newId = AnalyzerConstants.MSG_PROBE_UICONTROL;
+ break;
+ case LogCenterConstants.LOG_UI_EVENT:
+ newId = AnalyzerConstants.MSG_PROBE_UIEVENT;
+ break;
+ case LogCenterConstants.LOG_RESOURCE:
+ newId = AnalyzerConstants.MSG_PROBE_FILE;
+ break;
+ case LogCenterConstants.LOG_LIFECYCLE:
+ newId = AnalyzerConstants.MSG_PROBE_LIFECYCLE;
+ break;
+ case LogCenterConstants.LOG_SCREENSHOT:
+ newId = AnalyzerConstants.MSG_PROBE_SCREENSHOT;
+ break;
+ case LogCenterConstants.LOG_SCENE:
+ newId = AnalyzerConstants.MSG_PROBE_SCENE;
+ break;
+ case LogCenterConstants.LOG_DEVICE:
+ newId = AnalyzerConstants.MSG_DATA_SYSTEM;
+ break;
+ case LogCenterConstants.LOG_PROFILING:
+ newId = AnalyzerConstants.MSG_DATA_SAMPLE;
+ break;
+ case LogCenterConstants.LOG_THREAD:
+ newId = AnalyzerConstants.MSG_PROBE_THREAD;
+ break;
+ case LogCenterConstants.LOG_CUSTOM_CHART:
+ newId = AnalyzerConstants.MSG_PROBE_CUSTOM;
+ break;
+ case LogCenterConstants.LOG_SYNC:
+ newId = AnalyzerConstants.MSG_PROBE_SYNC;
+ break;
+ default:
+ // USER_FUNCTION
+ newId = oldId;
+ break;
+ }
+ return newId;
+ }
+
+ public void setCallstack(String input) {
+ callstackLog = input;
+ }
+
+ public String getCallstack() {
+ return callstackLog;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+public class DataChannelConstants {
+ public static final int BUFFER_SIZE = 1024;
+
+ public static final int MSG_PROCESS_INFO = 0x2002;
+ public static final int MSG_TERMINATE = 0x2004;
+ public static final int MSG_ERROR = 0x2005;
+ public static final int MSG_SAMPLE = 0x2006;
+ public static final int MSG_SYSTEM = 0x2007;
+ public static final int MSG_IMAGE = 0x2008;
+ public static final int MSG_RECORD = 0x2009;
+ public static final int MSG_FUNCTION_ENTRY = 0x2010;
+ public static final int MSG_FUNCTION_EXIT = 0x2011;
+ public static final int MSG_CONTEXT_SWITCH_ENTRY = 0x2012;
+ public static final int MSG_CONTEXT_SWITCH_EXIT = 0x2013;
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+public class LibraryObject {
+ private long lowestAddress = -1;
+ private long highestAddress = -1;
+ private String libPath = null;
+
+ public long getLowestAddress() {
+ return lowestAddress;
+ }
+
+ public void setLowestAddress(long lowestAddress) {
+ this.lowestAddress = lowestAddress;
+ }
+
+ public long getHighestAddress() {
+ return highestAddress;
+ }
+
+ public void setHighestAddress(long highestAddress) {
+ this.highestAddress = highestAddress;
+ }
+
+ public String getLibPath() {
+ return libPath;
+ }
+
+ public void setLibPath(String libPath) {
+ this.libPath = libPath;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProcessInfo {
+ private int pid = -1;
+ private long time = 0;
+ private long lowestAddress = 0;
+ private long highestAddress = 0;
+ private int appType = -1; // 1. tizen 2. capi
+ private int binaryType = -1; // pie option
+ private String binaryPath = null;
+ private int depLibCount = 0;
+ private List<LibraryObject> libObjs = new ArrayList<LibraryObject>();
+
+ public int getPid() {
+ return pid;
+ }
+
+ public void setPid(int pid) {
+ this.pid = pid;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ public void setTime(long time) {
+ this.time = time;
+ }
+
+ public long getLowestAddress() {
+ return lowestAddress;
+ }
+
+ public void setLowestAddress(long lowestAddress) {
+ this.lowestAddress = lowestAddress;
+ }
+
+ public long getHighestAddress() {
+ return highestAddress;
+ }
+
+ public void setHighestAddress(long highestAddress) {
+ this.highestAddress = highestAddress;
+ }
+
+ public int getAppType() {
+ return appType;
+ }
+
+ public void setAppType(int appType) {
+ this.appType = appType;
+ }
+
+ public int getBinaryType() {
+ return binaryType;
+ }
+
+ public void setBinaryType(int binaryType) {
+ this.binaryType = binaryType;
+ }
+
+ public String getBinaryPath() {
+ return binaryPath;
+ }
+
+ public void setBinaryPath(String binaryPath) {
+ this.binaryPath = binaryPath;
+ }
+
+ public int getDepLibCount() {
+ return depLibCount;
+ }
+
+ public void setDepLibCount(int depLibCount) {
+ this.depLibCount = depLibCount;
+ }
+
+ public List<LibraryObject> getLibObjs() {
+ return libObjs;
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class TestProbe {
+ int msgId = 0x3001;
+ int seq = 1;
+ long time = 1000000;
+
+ int appid = 9002;
+ int pid = 1002;
+ int tid = 44;
+ String args = "test string";
+ long ret = 29292;
+ int errno = -1;
+ int internalCall = 1;
+ long caller = 0x2222;
+ int reserved1 = 0;
+ int reserved2 = 0;
+
+ // memory
+ int size = 100;
+ int type = 10;
+ long addr = 0x1111;
+
+ int length = args.length()+ 1 + 60;
+
+ public byte[] getByteValue() {
+ return ByteUtils.getByte(msgId, seq, time, length, appid, pid, tid,
+ args, ret, errno, internalCall, caller, reserved1,
+ reserved2, size, type, addr);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.I;
+import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.L;
+import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.T;
+import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.A;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class CommonColumns {
+
+ private static String[] dcn = { "RID", "APPID", "PID", "TID", "args",
+ "Return", "PCAddr", "Errno", "InternalCall", "CallerPCAddr",
+ "Reserved", "Reserved" };
+ private static Integer[] dct = { I, I, I, I, T, T, I, I, T, I, I, I, I };
+ private static String[] tcn = { "App ID", "PID", "TID", "Args", "Return",
+ "Errno", "Internal Call", "Caller PCAddr","Reserved", "Reserved" };
+ private static Integer[] logTypes = { I, I, I, A, L, I, I, L, I, I };
+
+ private static List<String> dbColumnNames = null;
+ private static List<Integer> dbColumnTypes = null;
+ private static List<String> tableColumnNames = null;
+ private static List<Integer> types = null;
+
+ public static List<String> getDBColumnNames() {
+ if (null == dbColumnNames) {
+ dbColumnNames = new ArrayList<String>();
+ dbColumnNames = Arrays.asList(dcn);
+ }
+
+ ArrayList<String> ret = new ArrayList<String>();
+ ret.addAll(dbColumnNames);
+
+ return ret;
+ }
+
+ public static List<Integer> getDBColumntypes() {
+ if (null == dbColumnTypes) {
+ dbColumnTypes = Arrays.asList(dct);
+ }
+
+ ArrayList<Integer> ret = new ArrayList<Integer>();
+ ret.addAll(dbColumnTypes);
+ return ret;
+ }
+
+ public static List<String> getTableColumnNames() {
+ if (null == tableColumnNames) {
+ tableColumnNames = new ArrayList<String>();
+ tableColumnNames = Arrays.asList(tcn);
+ }
+ ArrayList<String> ret = new ArrayList<String>();
+ ret.addAll(tableColumnNames);
+ return ret;
+ }
+
+ public static List<Integer> getLogColumnTypes() {
+ if (null == types) {
+ types = Arrays.asList(logTypes);
+ }
+
+ ArrayList<Integer> ret = new ArrayList<Integer>();
+ ret.addAll(types);
+ return ret;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class ControlLogFormat extends LogFormat {
+ public static final int ID = 0x3002;
+ public static final String NAME = "Control";
+
+ private static ControlLogFormat instance = null;
+
+ public static ControlLogFormat getInstance() {
+ if (null == instance) {
+ instance = new ControlLogFormat();
+ }
+ return instance;
+ }
+
+ private ControlLogFormat() {
+ setId(ID);
+ setName(NAME);
+ String[] dcn = { "ParentName", "ParentClass", "ParentPointer",
+ "ChildName", "ChildClass", "ChildPointer" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { T, T, T, T, T, T };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Parent Name", "Parent Class", "Parent Pointer",
+ "Child Name", "Child Class", "Child Pointer" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { S, S, L, S, S, L };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class CustomChartLogFormat extends LogFormat {
+ public static final int ID = 0x3009;
+ public static final String NAME = "CustomChart";
+
+ private static CustomChartLogFormat instance = null;
+
+ public static CustomChartLogFormat getInstance() {
+ if (null == instance) {
+ instance = new CustomChartLogFormat();
+ }
+ return instance;
+ }
+
+ private CustomChartLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "Handle", "Type", "Name", "Color", "Value" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, T, I, T };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Handle", "Type", "Name", "Color", "Value" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, S, I, F };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class FileLogFormat extends LogFormat {
+ public static final int ID = 0x3004;
+ public static final String NAME = "File";
+
+ private static FileLogFormat instance = null;
+
+ public static FileLogFormat getInstance() {
+ if (null == instance) {
+ instance = new FileLogFormat();
+ }
+ return instance;
+ }
+
+ private FileLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "Size", "FDValue", "FDType", "FDApiType", "FileSize",
+ "FilePath" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, I, I, I, T };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Size", "FD Value", "FD Type", "FD Api Type",
+ "File Size", "FilePath" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, I, I, I, S };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+public class LifeCycleLogFormat extends LogFormat {
+ public static final int ID = 0x3005;
+ public static final String NAME = "LifeCycle";
+
+ private static LifeCycleLogFormat instance = null;
+
+ public static LifeCycleLogFormat getInstance() {
+ if (null == instance) {
+ instance = new LifeCycleLogFormat();
+ }
+ return instance;
+ }
+
+ private LifeCycleLogFormat() {
+ setId(ID);
+ setName(NAME);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LogFormat {
+ public static final int I = 1; // Integer
+ public static final int S = 2; // String
+ public static final int L = 3; // Long
+ public static final int D = 4; // Double
+ public static final int T = 5; // TEXT
+ public static final int F = 6; // Float
+ public static final int SI = 7; // Short int
+
+ // for system logs
+ public static final int CL = 8; // CPU load
+ public static final int CF = 9; // CPU frequency
+ public static final int TL = 10; // Thread load
+ public static final int PL = 11; // Process load
+ public static final int A = 12; // Entry args
+
+ protected List<String> dbColumnNames = null;
+ protected List<Integer> dbColumnTypes = null;
+ protected List<String> tableColumnNames = null;
+ protected List<Integer> logColumnTypes = null;
+
+ public static List<LogFormat> logFormats = null;
+
+ protected int id = -1;
+ protected String name = null;
+
+ public int getId() {
+ return id;
+ }
+
+ protected void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ protected void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getDBColumnNames() {
+ if (null == dbColumnNames) {
+ return CommonColumns.getDBColumnNames();
+ }
+ return dbColumnNames;
+ }
+
+ public List<Integer> getDBColumntypes() {
+ if (null == dbColumnTypes) {
+ return CommonColumns.getDBColumntypes();
+ }
+ return dbColumnTypes;
+ }
+
+ public List<String> getTableColumnNames() {
+ if (null == tableColumnNames) {
+ return CommonColumns.getTableColumnNames();
+ }
+ return tableColumnNames;
+ }
+
+ public List<Integer> getLogColumnTypes() {
+ if (null == logColumnTypes) {
+ return CommonColumns.getLogColumnTypes();
+ }
+ return logColumnTypes;
+ }
+
+ public int getDBTotalColumnCount() {
+ return getDBColumnNames().size();
+ }
+
+ public static List<LogFormat> getLogFormats() {
+ if (null == logFormats) {
+ logFormats = new ArrayList<LogFormat>();
+
+ logFormats.add(MemoryLogFormat.getInstance());
+ logFormats.add(ControlLogFormat.getInstance());
+ logFormats.add(UIEventLogFormat.getInstance());
+ logFormats.add(FileLogFormat.getInstance());
+ logFormats.add(LifeCycleLogFormat.getInstance());
+ logFormats.add(ScreenShotLogFormat.getInstance());
+ logFormats.add(SceneLogFormat.getInstance());
+ logFormats.add(ThreadLogFormat.getInstance());
+ logFormats.add(CustomChartLogFormat.getInstance());
+ logFormats.add(SyncLogFormat.getInstance());
+ }
+ return logFormats;
+ }
+
+ public static LogFormat getLogFormatById(int id) {
+ int size = getLogFormats().size();
+
+ for (int i = 0; i < size; i++) {
+ if (logFormats.get(i).getId() == id) {
+ return logFormats.get(i);
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class MemoryLogFormat extends LogFormat {
+ public static final int ID = 0x3001;
+ public static final String NAME = "Memory";
+
+ private static MemoryLogFormat instance = null;
+
+ public static MemoryLogFormat getInstance() {
+ if (null == instance) {
+ instance = new MemoryLogFormat();
+ }
+ return instance;
+ }
+
+ private MemoryLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "Size", "MemoryAPIType", "Address" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ for (String str : dcn) {
+ dbColumnNames.add(str);
+ }
+ // dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, T };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Size", "Memory API Type", "Address" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ for (String str : tcn) {
+ tableColumnNames.add(str);
+ }
+// tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, L };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class SceneLogFormat extends LogFormat {
+ public static final int ID = 0x3007;
+ public static final String NAME = "Scene";
+
+ private static SceneLogFormat instance = null;
+
+ public static SceneLogFormat getInstance() {
+ if (null == instance) {
+ instance = new SceneLogFormat();
+ }
+ return instance;
+ }
+
+ private SceneLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "SceneName", "FormName", "FormPointer", "PanelName",
+ "PanelPointer", "TransitionTime", "UserTransitionTime" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { T, T, T, T, T, I, I };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Scene Name", "Form Name", "Form Pointer",
+ "Panel Name", "Panel Pointer", "Transition Time",
+ "User Transition Time" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { S, S, L, S, L, I, I };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class ScreenShotLogFormat extends LogFormat {
+ public static final int ID = 0x3006;
+ public static final String NAME = "ScreenShot";
+
+ private static ScreenShotLogFormat instance = null;
+
+ public static ScreenShotLogFormat getInstance() {
+ if (null == instance) {
+ instance = new ScreenShotLogFormat();
+ }
+ return instance;
+ }
+
+ private ScreenShotLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "ImageFilePath", "Orientation" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { T, I };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Image File Path", "Orientation" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { S, I };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class SyncLogFormat extends LogFormat {
+ public static final int ID = 0x3010;
+ public static final String NAME = "Sync";
+
+ private static SyncLogFormat instance = null;
+
+ public static SyncLogFormat getInstance() {
+ if (null == instance) {
+ instance = new SyncLogFormat();
+ }
+ return instance;
+ }
+
+ private SyncLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "SyncValue", "SyncType", "ApiType" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, I };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Sync Value", "Sync Type", "Api Type" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, I };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class SystemLogFormat extends LogFormat {
+ public static final int ID = 0x2007;
+ public static final String NAME = "System";
+
+ private static SystemLogFormat instance = null;
+
+ public static SystemLogFormat getInstance() {
+ if (null == instance) {
+ instance = new SystemLogFormat();
+ }
+ return instance;
+ }
+
+ private SystemLogFormat() {
+ setId(ID);
+ setName(NAME);
+ String[] dcn = { "RID", "Energy", "WiFi status", "BT status",
+ "GPS status", "Brightness status", "Camera status",
+ "Sound status", "Audio status", "Vibration status",
+ "Voltage status", "RSSI status", "Video status", "Call status",
+ "DNet status", "CPU frequency", "App CPU usage", "CPU load",
+ "Virtual memory", "Resident memory", "Shared memory",
+ "PSS memory", "Total alloc size", "System memory total",
+ "System memory used", "Total used drive", "Count of threads",
+ "Thread load", "count of processes", "Process load",
+ "DISK read size", "DISK write size", "Network send size",
+ "Network receive size" };
+ dbColumnNames = new ArrayList<String>();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, I, I, I, I, // 1 + 5 : 1 is RID
+ I, I, I, I, I,// 10
+ I, I, I, I, CF, // 15
+ F, CL, I, I, I, // 20
+ I, I, I, I, I, // 25
+ I, TL, I, PL, I, // 30
+ I, I, I }; // 33
+ dbColumnTypes = new ArrayList<Integer>();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Energy", "WiFi status", "BT status", "GPS status",
+ "Brightness status", "Camera status", "Sound status",
+ "Audio status", "Vibration status", "Voltage status",
+ "RSSI status", "Video status", "Call status", "DNet status",
+ "CPU frequency", "App CPU usage", "CPU load", "Virtual memory",
+ "Resident memory", "Shared memory", "PSS memory",
+ "Total alloc size", "System memory total",
+ "System memory used", "Total used drive", "Count of threads",
+ "Thread load", "count of processes", "Process load",
+ "DISK read size", "DISK write size", "Network send size",
+ "Network receive size" };
+ tableColumnNames = new ArrayList<String>();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, I, I, I, // 5
+ I, I, I, I, I,// 10
+ I, I, I, I, CF, // 15
+ F, CL, I, I, I, // 20
+ I, I, I, I, I, // 25
+ I, TL, I, PL, I, // 30
+ I, I, I }; // 33
+ logColumnTypes = new ArrayList<Integer>();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+
+ public List<String> getDBColumnNames() {
+ return dbColumnNames;
+ }
+
+ public List<Integer> getDBColumntypes() {
+ return dbColumnTypes;
+ }
+
+ public List<String> getTableColumnNames() {
+ return tableColumnNames;
+ }
+
+ public List<Integer> getLogColumnTypes() {
+ return logColumnTypes;
+ }
+
+ public int getDBTotalColumnCount() {
+ return getDBColumnNames().size();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class ThreadLogFormat extends LogFormat {
+ public static final int ID = 0x3008;
+ public static final String NAME = "Thread";
+
+ private static ThreadLogFormat instance = null;
+
+ public static ThreadLogFormat getInstance() {
+ if (null == instance) {
+ instance = new ThreadLogFormat();
+ }
+ return instance;
+ }
+
+ private ThreadLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "PThreadID", "OspThreadID", "ThreadType", "ApiType" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, I, I };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "PThread ID", "Osp Thread ID", "Thread Type",
+ "Api Type" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, I, I };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class UIEventLogFormat extends LogFormat {
+ public static final int ID = 0x3003;
+ public static final String NAME = "UIEvent";
+
+ private static UIEventLogFormat instance = null;
+
+ public static UIEventLogFormat getInstance() {
+ if (null == instance) {
+ instance = new UIEventLogFormat();
+ }
+ return instance;
+ }
+
+ private UIEventLogFormat() {
+ setId(ID);
+ setName(NAME);
+
+ String[] dcn = { "EventType", "DetailType", "X", "Y", "Info1", "Info2" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { I, I, I, I, I, I };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "Event Type", "Detail Type", "X", "Y", "Info1",
+ "Info2" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { I, I, I, I, I, I };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+
+public class BasicDataFactory {
+ public static BasicDataInterface createBasicDataInstance() {
+ BasicDataInterface instance = null;
+
+ String version = DACommunicator.getTargetVersion();
+ if (version.contains("3.0")) {
+ instance = new BasicDataMessage();
+ } else if (version.contains("2.1.1")) {
+ instance = new BasicDataMessage22();
+ }
+ return instance;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+public interface BasicDataInterface {
+ public int getId();
+ public int getSeq();
+ public long getTime();
+ public void setTime(long time);
+
+ public String[] getLog();
+ public byte[] getPayload();
+ public BasicDataInterface getClone();
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+
+public class BasicDataMessage22 implements BasicDataInterface {
+
+ protected int id = -1;
+ protected int seq = -1;
+ protected long time = -1;
+
+ protected String[] log;
+
+ public void makeData(String[] splitLog) {
+ log = splitLog;
+ id = Integer.parseInt(log[LogCenterConstants.ID_INDEX]);
+ seq = Integer.parseInt(log[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
+ time = Long.parseLong(log[LogCenterConstants.TIME_INDEX]);
+ }
+
+ @Override
+ public int getId() {
+ return id;
+ }
+
+ @Override
+ public int getSeq() {
+ return seq;
+ }
+
+ @Override
+ public long getTime() {
+ return time;
+ }
+
+ @Override
+ public String[] getLog() {
+ return log;
+ }
+
+ @Override
+ public byte[] getPayload() {
+ // unused, for version 3.0
+ return null;
+ }
+
+ @Override
+ public BasicDataInterface getClone() {
+ BasicDataMessage22 clone = new BasicDataMessage22();
+ clone.id = this.id;
+ clone.seq = this.seq;
+ clone.time = this.time;
+ clone.log = this.log.clone();
+ return clone;
+ }
+
+ @Override
+ public void setTime(long time) {
+ String input = Long.toString(time);
+ log[LogCenterConstants.TIME_INDEX] = input;
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class ControlData extends ProbeCommonData {
+ private int parentNameIndex = 0;
+ private int parentClassNameIndex = 0;
+ private int parentPointerIndex = 0;
+ private int childNameIndex = 0;
+ private int childClassNameIndex = 0;
+ private int childPointerIndex = 0;
+
+ public ControlData(BasicDataInterface data) {
+ super(data);
+ parentNameIndex = getCommonColumnsSize();
+ parentClassNameIndex = parentNameIndex
+ + getStringLength(parentNameIndex);
+ parentPointerIndex = parentClassNameIndex
+ + getStringLength(parentClassNameIndex);
+ childNameIndex = parentPointerIndex + CommonConstants.LONG_SIZE;
+ childClassNameIndex = childNameIndex + getStringLength(childNameIndex);
+ childPointerIndex = childClassNameIndex
+ + getStringLength(childClassNameIndex);
+ }
+
+ public String getParentName() {
+ byte[] temp = new byte[parentClassNameIndex - parentNameIndex];
+ System.arraycopy(payload, parentNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public String getParentClassName() {
+ byte[] temp = new byte[parentPointerIndex - parentClassNameIndex];
+ System.arraycopy(payload, parentClassNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public long getParentPointer() {
+ return ByteUtils.toLong(payload, parentPointerIndex);
+ }
+
+ public String getChildName() {
+ byte[] temp = new byte[childClassNameIndex - childNameIndex];
+ System.arraycopy(payload, childNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public String getChildClassName() {
+ byte[] temp = new byte[childPointerIndex - childClassNameIndex];
+ System.arraycopy(payload, childClassNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public long getChildPointer() {
+ return ByteUtils.toLong(payload, childPointerIndex);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class CustomData extends ProbeCommonData {
+
+ private int handleIndex = 0;
+ private int typeIndex = 0;
+ private int nameIndex = 0;
+ private int colorIndex = 0;
+ private int valueIndex = 0;
+
+ public CustomData(BasicDataInterface data) {
+ super(data);
+ handleIndex = getCommonColumnsSize();
+ typeIndex = handleIndex + CommonConstants.INT_SIZE;
+ nameIndex = typeIndex + CommonConstants.INT_SIZE;
+ colorIndex = getStringLength(nameIndex);
+ valueIndex = colorIndex + CommonConstants.INT_SIZE;
+ }
+
+ public int getHandle() {
+ return ByteUtils.toInt(payload, handleIndex);
+ }
+
+ public int getType() {
+ return ByteUtils.toInt(payload, typeIndex);
+ }
+
+ public String getName() {
+
+ byte[] temp = new byte[colorIndex - nameIndex];
+ System.arraycopy(payload, nameIndex, temp, 0, temp.length);
+ return new String(temp);
+
+ }
+
+ public int getColor() {
+ return ByteUtils.toInt(payload, colorIndex);
+ }
+
+ public double getValue() {
+ return ByteUtils.toDouble(payload, valueIndex);
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import java.util.List;
+
+public class FailedData2 {
+ public static final int ID_INDEX = 1;
+ public static final int SEQ_INDEX = 2;
+ public static final int TIME_INDEX = 3;
+ public static final int NAME_INDEX = 4;
+ public static final int ARGS_INDEX = 5;
+ public static final int RETURN_INDEX = 6;
+ public static final int ERROR_INDEX = 7;
+ public static final int CALLER_INDEX = 8;
+
+ private static int LogNum = 0;
+ // private LogData data;
+
+ private int id = -1;
+ private int seq = -1;
+ private long time = -1;
+ private String apiName = null;
+ private String args = null;
+ private long ret = -1;
+ private long err = -1;
+ private long callerPc = -1;
+
+ public FailedData2(LogData log) {
+ id = log.getId();
+ seq = log.getSeq();
+ time = log.getTime();
+ ProbeCommonData plog = ((ProbeCommonData) log);
+ apiName = plog.getApiName();
+ args = plog.getArgs();
+ ret = plog.getReturn();
+ err = plog.getErrno();
+ callerPc = plog.getCallerPcAddr();
+ }
+
+ public FailedData2(List<String> input) {
+ if (null != input && !input.isEmpty()) {
+ id = Integer.parseInt(input.get(ID_INDEX));
+ seq = Integer.parseInt(input.get(SEQ_INDEX));
+ time = Long.parseLong(input.get(TIME_INDEX));
+ apiName = input.get(NAME_INDEX);
+ args = input.get(ARGS_INDEX);
+ ret = Long.parseLong(input.get(RETURN_INDEX));
+ err = Integer.parseInt(input.get(ERROR_INDEX));
+ callerPc = Long.parseLong(input.get(CALLER_INDEX));
+ }
+ }
+
+ public static int getLogNum() {
+ return LogNum++;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public int getSeq() {
+ return seq;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ public String getName() {
+ return apiName;
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public long getReturn() {
+ return ret;
+ }
+
+ public long getErrorCode() {
+ return err;
+ }
+
+ public long getCallerPc() {
+ return callerPc;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class FileData extends ProbeCommonData {
+
+ private int sizeIndex = 0;
+ private int fdValueIndex = 0;
+ private int fdTypeIndex = 0;
+ private int fdApiTypeIndex = 0;
+ private int fileSizeIndex = 0;
+ private int filePathIndex = 0;
+
+ public FileData(BasicDataInterface data) {
+ super(data);
+ sizeIndex = getCommonColumnsSize();
+ fdValueIndex = sizeIndex + CommonConstants.INT_SIZE;
+ fdTypeIndex = fdValueIndex + CommonConstants.INT_SIZE;
+ fdApiTypeIndex = fdTypeIndex + CommonConstants.INT_SIZE;
+ fileSizeIndex = fdApiTypeIndex + CommonConstants.INT_SIZE;
+ filePathIndex = fileSizeIndex + CommonConstants.INT_SIZE;
+ }
+
+ public int getSize() {
+ return ByteUtils.toInt(payload, sizeIndex);
+ }
+
+ public int getFDValue() {
+ return ByteUtils.toInt(payload, fdValueIndex);
+ }
+
+ public int getFDType() {
+ return ByteUtils.toInt(payload, fdTypeIndex);
+ }
+
+ public int getFDApiType() {
+ return ByteUtils.toInt(payload, fdApiTypeIndex);
+ }
+
+ public int getFileSize() {
+ return ByteUtils.toInt(payload, fileSizeIndex);
+ }
+
+ public String getFilePath() {
+ int length = getStringLength(filePathIndex);
+ byte[] temp = new byte[length];
+ System.arraycopy(payload, filePathIndex, temp, 0, length);
+ return new String(temp);
+ }
+
+ @Override
+ public int getKey() {
+ Integer key = getFDValue();
+ return key.hashCode();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
+
+public class LeakData2 {
+ private static int logNum = 0;
+ private int key = -1;
+ private long addr = -1;
+ private int seq = -1;
+ private int id = -1;
+ private long time = -1;
+ private String name = null;
+ private String param = null;
+ private long ret = -1;
+ private int leakSeq = -1;
+ private long callerPc = -1;
+
+ private int parentKey = -1;
+
+ private List<LeakData2> children;
+
+ public LeakData2(LogData log, LeakDetector leakDetector) {
+ leakSeq = leakDetector.getLeakSeq();
+ leakDetector.increaseLeakSeq();
+ this.key = log.getKey();
+ this.seq = log.getSeq();
+ this.id = log.getId();
+ this.time = log.getTime();
+ // TODO : name field
+ ProbeCommonData pcd = (ProbeCommonData) log;
+ this.name = pcd.getApiName();
+ this.param = pcd.getArgs();
+ this.ret = pcd.getReturn();
+ this.callerPc = pcd.getCallerPcAddr();
+
+ if (log instanceof MemoryData) {
+ this.addr = ((MemoryData) log).getAddress();
+ }
+ }
+
+ // load data
+ public LeakData2(List<String> loadData) {
+ // key = Integer.parseInt(loadData.get(index))
+ // data.set(KEY_INDEX, loadData.get(KEY_INDEX));
+ // data.set(SEQUENCE_INDEX, loadData.get(SEQUENCE_INDEX));
+ // data.set(ID_INDEX, loadData.get(ID_INDEX));
+ // data.set(TIME_INDEX, loadData.get(TIME_INDEX));
+ // data.set(NAME_INDEX, loadData.get(NAME_INDEX));
+ // data.set(PARAM_INDEX, loadData.get(PARAM_INDEX));
+ // data.set(RETURN_INDEX, loadData.get(RETURN_INDEX));
+ // data.set(LEAK_SEQ_INDEX, loadData.get(LEAK_SEQ_INDEX));
+ // data.set(PARENT_KEY_INDEX, loadData.get(PARENT_KEY_INDEX));
+ }
+
+ public int getKey() {
+ return key;
+ }
+
+ public void setKey(int key) {
+ this.key = key;
+ }
+
+ public long getAddr() {
+ return addr;
+ }
+
+ public void setAddr(long addr) {
+ this.addr = addr;
+ }
+
+ public int getSeq() {
+ return seq;
+ }
+
+ public void setSeq(int seq) {
+ this.seq = seq;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ public void setTime(long time) {
+ this.time = time;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getParam() {
+ return param;
+ }
+
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ public long getRet() {
+ return ret;
+ }
+
+ public void setRet(long ret) {
+ this.ret = ret;
+ }
+
+ public int getLeakSeq() {
+ return leakSeq;
+ }
+
+ public void setLeakSeq(int leakSeq) {
+ this.leakSeq = leakSeq;
+ }
+
+ public int getParentKey() {
+ return parentKey;
+ }
+
+ public void setParentKey(int parentKey) {
+ this.parentKey = parentKey;
+ }
+
+ public long getCallerPc() {
+ return callerPc;
+ }
+
+ public void setCallerPc(long callerPc) {
+ this.callerPc = callerPc;
+ }
+
+ public List<LeakData2> getChildren() {
+ if (null == children) {
+ children = new ArrayList<LeakData2>();
+ }
+ return children;
+ }
+
+ public void setChildren(List<LeakData2> children) {
+ this.children = children;
+ }
+
+ public void addChild(LeakData2 child) {
+ getChildren().add(child);
+ }
+
+ public void removeChild(int key) {
+ int size = children.size();
+ for (int i = 0; i < size; i++) {
+ if (key == children.get(i).getKey()) {
+ children.remove(i);
+ break;
+ }
+ }
+ }
+
+ public static int getLogNum() {
+ return logNum++;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+public class LifeCycleData extends ProbeCommonData {
+
+ public LifeCycleData(BasicDataInterface data) {
+ super(data);
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class LogData {
+ public static int API_ID_INDEX = 0;
+ public static int PID_INDEX = API_ID_INDEX + CommonConstants.INT_SIZE;
+ public static int TID_INDEX = PID_INDEX + CommonConstants.INT_SIZE;
+ public static boolean isSWAP = false;
+
+ protected BasicDataInterface basicData = null;
+ protected byte[] payload = null;
+
+ public LogData(BasicDataInterface data) {
+ isSWAP = DACommunicator.isSWAPVersion();
+ basicData = data;
+ payload = data.getPayload();
+ }
+
+ public int getId() {
+ return basicData.getId();
+ }
+
+ public int getSeq() {
+ return basicData.getSeq();
+ }
+
+ public long getTime() {
+ return basicData.getTime();
+ }
+
+ public void setTime(long time) {
+ basicData.setTime(time);
+ }
+
+ public byte[] getPayload() {
+ return payload;
+ }
+
+ protected int getStringLength(int start) {
+ int length = 0;
+ for (int i = start; i < payload.length; i++, length++) {
+ if (payload[i] == 0) {
+ return length + 1;
+ }
+ }
+ return payload.length;
+ }
+
+ protected String makeArgs(int start) {
+ int countOfArgs = ByteUtils.toInt(payload, start);
+ start += CommonConstants.INT_SIZE;
+ StringBuffer buffer = new StringBuffer();
+ for (int ii = 0; ii < countOfArgs; ii++) {
+ char c = (char) payload[start];
+ start += 1;
+ switch (c) {
+ case 'c':
+ buffer.append((payload[start]));
+ start += 1;
+ break;
+ case 'd':
+ int iValue = ByteUtils.toInt(payload, start);
+ buffer.append(iValue);
+ start += Integer.SIZE / Byte.SIZE;
+ break;
+ case 'x':
+ long lValue = ByteUtils.toLong(payload, start);
+ buffer.append(lValue);
+ start += Long.SIZE / Byte.SIZE;
+ break;
+ case 'p':
+ long pValue = ByteUtils.toLong(payload, start);
+ buffer.append(Long.toHexString(pValue));
+ start += Long.SIZE / Byte.SIZE;
+ break;
+ case 'f':
+ float fValue = ByteUtils.toFloat(payload, start);
+ buffer.append(fValue);
+ start += Float.SIZE / Byte.SIZE;
+ break;
+ case 'w':
+ double dValue = ByteUtils.toDouble(payload, start);
+ buffer.append(dValue);
+ start += Double.SIZE / Byte.SIZE;
+ break;
+ case 's':
+ for (int iii = start; iii < payload.length; iii++) {
+ if (payload[iii] != 0) {
+ buffer.append((char) payload[iii]);
+ } else {
+ start = iii + 1;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if (ii + 1 != countOfArgs) {
+ buffer.append(',');
+ }
+ }
+ return buffer.toString();
+ }
+
+ public LogData getClone() {
+ LogData clone = LogDataFactory.createInstance(basicData);
+ return clone;
+ }
+
+ public int getKey() {
+ Integer key = getSeq();
+ return key.hashCode();
+ }
+
+ protected static String getQuestionMarks(int count) {
+ // row number
+ // id
+ // seq
+ // time
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < count; i++) {
+ buf.append("? ");
+ if (i + 1 != count) {
+ buf.append(CommonConstants.COMMA);
+ }
+ }
+ return buf.toString();
+ }
+
+ // indicate DB row number
+ public int getLogNum() {
+ return 0;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+
+public class LogDataFactory {
+ private static List<Integer> logList = new ArrayList<Integer>();
+
+ private LogDataFactory() {
+ // is static class
+ }
+
+ public static List<Integer> getLogList() {
+ if (logList.isEmpty()) {
+ initLogList();
+ }
+ return logList;
+ }
+
+ public static void initLogList() {
+ logList.clear();
+// if (DACommunicator.isSWAPVersion()) {
+ logList.add(AnalyzerConstants.MSG_PROBE_MEMORY);
+ logList.add(AnalyzerConstants.MSG_PROBE_UICONTROL);
+ logList.add(AnalyzerConstants.MSG_PROBE_UIEVENT);
+ logList.add(AnalyzerConstants.MSG_PROBE_FILE);
+ logList.add(AnalyzerConstants.MSG_PROBE_LIFECYCLE);
+ logList.add(AnalyzerConstants.MSG_PROBE_SCREENSHOT);
+ logList.add(AnalyzerConstants.MSG_PROBE_SCENE);
+ logList.add(AnalyzerConstants.MSG_PROBE_THREAD);
+ logList.add(AnalyzerConstants.MSG_PROBE_CUSTOM);
+ logList.add(AnalyzerConstants.MSG_PROBE_SYNC);
+ logList.add(AnalyzerConstants.MSG_DATA_SAMPLE);
+ logList.add(AnalyzerConstants.MSG_DATA_SYSTEM);
+ logList.add(LogCenterConstants.LOG_USER_FUNCTION);
+// } else {
+// logList.add(LogCenterConstants.LOG_MEMORY);
+// logList.add(LogCenterConstants.LOG_CONTROL);
+// logList.add(LogCenterConstants.LOG_RECODER);
+// logList.add(LogCenterConstants.LOG_RESOURCE);
+// logList.add(LogCenterConstants.LOG_LIFECYCLE);
+// logList.add(LogCenterConstants.LOG_SCREENSHOT);
+// logList.add(LogCenterConstants.LOG_SCENE);
+// logList.add(LogCenterConstants.LOG_THREAD);
+// logList.add(LogCenterConstants.LOG_CUSTOM_CHART);
+// logList.add(LogCenterConstants.LOG_SYNC);
+// logList.add(LogCenterConstants.LOG_USER_FUNCTION);
+// logList.add(LogCenterConstants.LOG_PROFILING);
+// logList.add(LogCenterConstants.LOG_DEVICE);
+// }
+
+ }
+
+ public static LogData createInstance(BasicDataInterface input) {
+ int id = input.getId();
+ LogData output = null;
+ switch (id) {
+ case AnalyzerConstants.MSG_PROBE_MEMORY:
+ case LogCenterConstants.LOG_MEMORY:
+ // memory
+ output = new MemoryData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_UICONTROL:
+ case LogCenterConstants.LOG_CONTROL:
+ // ui control
+ output = new ControlData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_UIEVENT:
+ case LogCenterConstants.LOG_UI_EVENT:
+ output = new UIEventData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_FILE:
+ case LogCenterConstants.LOG_RESOURCE:
+ // file
+ output = new FileData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_LIFECYCLE:
+ case LogCenterConstants.LOG_LIFECYCLE:
+ // life cycle
+ output = new LifeCycleData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCREENSHOT:
+ case LogCenterConstants.LOG_SCREENSHOT:
+ // screenshot
+ output = new ScreenShotData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCENE:
+ case LogCenterConstants.LOG_SCENE:
+ // scene
+ output = new SceneData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_THREAD:
+ case LogCenterConstants.LOG_THREAD:
+ // thread
+ output = new ThreadData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_CUSTOM:
+ case LogCenterConstants.LOG_CUSTOM_CHART:
+ // custom
+ output = new CustomData(input);
+ break;
+ case AnalyzerConstants.MSG_PROBE_SYNC:
+ case LogCenterConstants.LOG_SYNC:
+ // sync
+ output = new SyncData(input);
+ break;
+ case LogCenterConstants.LOG_USER_FUNCTION:
+ // user fucntion entry/exit
+ output = new UserFunctionData(input);
+ break;
+ case AnalyzerConstants.MSG_DATA_SAMPLE:
+ case LogCenterConstants.LOG_PROFILING:
+ // profiling sample log
+ output = new ProfileData(input);
+ break;
+ case AnalyzerConstants.MSG_DATA_SYSTEM:
+ case LogCenterConstants.LOG_DEVICE:
+ // system log
+ output = new SystemData(input);
+ break;
+ default:
+
+ }
+ return output;
+ }
+
+ public static String getTableNamebyId(int id) {
+ String name = null;
+ switch (id) {
+ case AnalyzerConstants.MSG_PROBE_MEMORY:
+ case LogCenterConstants.LOG_MEMORY:
+ // memory
+ name = "memory";
+ break;
+ case AnalyzerConstants.MSG_PROBE_UICONTROL:
+ case LogCenterConstants.LOG_CONTROL:
+ // ui control
+ name = "control";
+ break;
+ case AnalyzerConstants.MSG_PROBE_UIEVENT:
+ case LogCenterConstants.LOG_UI_EVENT:
+ name = "uievent";
+ break;
+ case AnalyzerConstants.MSG_PROBE_FILE:
+ case LogCenterConstants.LOG_RESOURCE:
+ // file
+ name = "file";
+ break;
+ case AnalyzerConstants.MSG_PROBE_LIFECYCLE:
+ case LogCenterConstants.LOG_LIFECYCLE:
+ // life cycle
+ name = "lifecycle";
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCREENSHOT:
+ case LogCenterConstants.LOG_SCREENSHOT:
+ // screenshot
+ name = "screenshot";
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCENE:
+ case LogCenterConstants.LOG_SCENE:
+ // scene
+ name = "scene";
+ break;
+ case AnalyzerConstants.MSG_PROBE_THREAD:
+ case LogCenterConstants.LOG_THREAD:
+ // thread
+ name = "thread";
+ break;
+ case AnalyzerConstants.MSG_PROBE_CUSTOM:
+ case LogCenterConstants.LOG_CUSTOM_CHART:
+ // custom
+ name = "custom";
+ break;
+ case AnalyzerConstants.MSG_PROBE_SYNC:
+ case LogCenterConstants.LOG_SYNC:
+ // sync
+ name = "sync";
+ break;
+ case LogCenterConstants.LOG_USER_FUNCTION:
+ // user fucntion entry/exit
+ name = "user_function";
+ break;
+ case AnalyzerConstants.MSG_DATA_SAMPLE:
+ case LogCenterConstants.LOG_PROFILING:
+ // profiling sample log
+ name = "profiling";
+ break;
+ case AnalyzerConstants.MSG_DATA_SYSTEM:
+ case LogCenterConstants.LOG_DEVICE:
+ // system log
+ name = "system";
+ break;
+ default:
+
+ }
+ return name;
+ }
+
+ public static int getLogColumnCountbyId(int id) {
+ int count = 0;
+ switch (id) {
+ case AnalyzerConstants.MSG_PROBE_MEMORY:
+ case LogCenterConstants.LOG_MEMORY:
+ // memory
+ count = 16;
+ break;
+ case AnalyzerConstants.MSG_PROBE_UICONTROL:
+ case LogCenterConstants.LOG_CONTROL:
+ // ui control
+ count = 19;
+ break;
+ case AnalyzerConstants.MSG_PROBE_UIEVENT:
+ case LogCenterConstants.LOG_UI_EVENT:
+ count = 19;
+ break;
+ case AnalyzerConstants.MSG_PROBE_FILE:
+ case LogCenterConstants.LOG_RESOURCE:
+ // file
+ count = 19;
+ break;
+ case AnalyzerConstants.MSG_PROBE_LIFECYCLE:
+ case LogCenterConstants.LOG_LIFECYCLE:
+ // life cycle
+ count = 12;
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCREENSHOT:
+ case LogCenterConstants.LOG_SCREENSHOT:
+ // screenshot
+ count = 15;
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCENE:
+ case LogCenterConstants.LOG_SCENE:
+ // scene
+ count = 20;
+ break;
+ case AnalyzerConstants.MSG_PROBE_THREAD:
+ case LogCenterConstants.LOG_THREAD:
+ // thread
+ count = 17;
+ break;
+ case AnalyzerConstants.MSG_PROBE_CUSTOM:
+ case LogCenterConstants.LOG_CUSTOM_CHART:
+ // custom
+ count = 18;
+ break;
+ case AnalyzerConstants.MSG_PROBE_SYNC:
+ case LogCenterConstants.LOG_SYNC:
+ // sync
+ count = 16;
+ break;
+ case LogCenterConstants.LOG_USER_FUNCTION:
+ // user fucntion entry/exit
+ count = 17;
+ break;
+ case AnalyzerConstants.MSG_DATA_SAMPLE:
+ case LogCenterConstants.LOG_PROFILING:
+ // profiling sample log
+ count = 4;
+ break;
+ case AnalyzerConstants.MSG_DATA_SYSTEM:
+ case LogCenterConstants.LOG_DEVICE:
+ // system log
+ count = 35;
+ break;
+ default:
+
+ }
+ return count;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class MemoryData extends ProbeCommonData {
+ private int sizeIndex = 0;
+ private int memoryApiTypeIndex = 0;
+ private int addrIndex = 0;
+
+ public MemoryData(BasicDataInterface data) {
+ super(data);
+ sizeIndex = getCommonColumnsSize();
+ memoryApiTypeIndex = sizeIndex + CommonConstants.INT_SIZE;
+ addrIndex = memoryApiTypeIndex + CommonConstants.INT_SIZE;
+ }
+
+ public int getSize() {
+ return ByteUtils.toInt(payload, sizeIndex);
+ }
+
+ public int getMemoryApiType() {
+ return ByteUtils.toInt(payload, memoryApiTypeIndex);
+ }
+
+ public long getAddress() {
+ return ByteUtils.toLong(payload, addrIndex);
+ }
+
+ @Override
+ public int getKey() {
+ Long key = getAddress();
+ return key.hashCode();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import static org.tizen.dynamicanalyzer.common.CommonConstants.DOUBLE_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.FLOAT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
+
+public class ProbeCommonData extends LogData {
+ private String args = null;
+
+ private static int rowNum = 0;
+
+ private int apiIdIndex = 0;
+ private int pidIndex = -1;
+ private int tidIndex = -1;
+ private int argIndex = -1;
+ private int returnIndex = -1;
+ private int errnoIndex = -1;
+ private int internalCallIndex = -1;
+ private int callerPcAddrIndex = -1;
+ private int reserved1Index = -1;
+ private int reserved2Index = -1;
+ private int commonColumnsSize = -1;
+
+ private String apiName = null;
+
+ public ProbeCommonData(BasicDataInterface data) {
+ super(data);
+ apiIdIndex = 0;
+ pidIndex = apiIdIndex + INT_SIZE;
+ tidIndex = pidIndex + INT_SIZE;
+ argIndex = tidIndex + INT_SIZE;
+ returnIndex = parseArgs();
+ errnoIndex = returnIndex + LONG_SIZE;
+ internalCallIndex = errnoIndex + LONG_SIZE;
+ callerPcAddrIndex = internalCallIndex + INT_SIZE;
+ reserved1Index = callerPcAddrIndex + LONG_SIZE;
+ reserved2Index = reserved1Index + INT_SIZE;
+ commonColumnsSize = reserved2Index + INT_SIZE;
+ }
+
+ public int getApiId() {
+ return ByteUtils.toInt(payload, apiIdIndex);
+ }
+
+ public String getApiName() {
+ if (null == apiName) {
+ apiName = ApiNameManager.getApiName(getApiId());
+ }
+ return apiName;
+ }
+
+ public void setApiName(String name) {
+ apiName = name;
+ }
+
+ public int getPid() {
+ return ByteUtils.toInt(payload, pidIndex);
+ }
+
+ public int getTid() {
+ return ByteUtils.toInt(payload, tidIndex);
+ }
+
+ public long getTime() {
+ return basicData.getTime();
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public long getReturn() {
+ return ByteUtils.toLong(payload, returnIndex);
+ }
+
+ public long getErrno() {
+ return ByteUtils.toLong(payload, errnoIndex);
+ }
+
+ public int getInternalCall() {
+ return ByteUtils.toInt(payload, internalCallIndex);
+ }
+
+ public long getCallerPcAddr() {
+ return ByteUtils.toLong(payload, callerPcAddrIndex);
+ }
+
+ public int getReserved1() {
+ return ByteUtils.toInt(payload, reserved1Index);
+ }
+
+ public int getReserved2() {
+ return ByteUtils.toInt(payload, reserved2Index);
+ }
+
+ public int getCommonColumnsSize() {
+ return commonColumnsSize;
+ }
+
+ private int parseArgs() {
+ int index = TID_INDEX + INT_SIZE;
+ int countOfArgs = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+ StringBuffer buffer = new StringBuffer();
+ for (int ii = 0; ii < countOfArgs; ii++) {
+ char c = (char) payload[index];
+ index += 1;
+ switch (c) {
+ case 'c':
+ buffer.append((payload[index]));
+ index += 1;
+ break;
+ case 'd':
+ int iValue = ByteUtils.toInt(payload, index);
+ buffer.append(iValue);
+ index += Integer.SIZE / Byte.SIZE;
+ break;
+ case 'x':
+ long lValue = ByteUtils.toLong(payload, index);
+ buffer.append(lValue);
+ index += LONG_SIZE;
+ break;
+ case 'p':
+ long pValue = ByteUtils.toLong(payload, index);
+ buffer.append(Long.toHexString(pValue));
+ index += LONG_SIZE;
+ break;
+ case 'f':
+ float fValue = ByteUtils.toFloat(payload, index);
+ buffer.append(fValue);
+ index += FLOAT_SIZE;
+ break;
+ case 'w':
+ double dValue = ByteUtils.toDouble(payload, index);
+ buffer.append(dValue);
+ index += DOUBLE_SIZE;
+ break;
+ case 's':
+ for (int iii = index; iii < payload.length; iii++) {
+ if (payload[iii] != 0) {
+ buffer.append((char) payload[iii]);
+ } else {
+ index = iii + 1;
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if (ii + 1 != countOfArgs) {
+ buffer.append(',');
+ }
+ }
+ args = buffer.toString();
+ return index;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+
+public class ProfileData extends LogData {
+
+ private int pcAddrIndex = -1; // profiling common
+ private int callerPcAddrIndex = -1; // function entry specific
+ private int probeTypeIndex = -1;// function entry specific
+ private int probeSubTypeIndex = -1;// function entry specific
+ private int pidIndex = -1; // profiling common
+ private int tidIndex = -1; // profiling common
+ private int cpuNumIndex = -1; // profiling common
+ private int argsIndex = -1; // function entry specific
+ private int returnIndex = -1;
+
+ private int callstackIndex = -1;
+
+ public ProfileData(BasicDataInterface data) {
+ super(data);
+ switch (getId()) {
+ case AnalyzerConstants.MSG_DATA_FUNCTION_ENTRY:
+ pcAddrIndex = 0;
+ callerPcAddrIndex = pcAddrIndex + CommonConstants.LONG_SIZE;
+ probeTypeIndex = callerPcAddrIndex + CommonConstants.LONG_SIZE;
+ probeSubTypeIndex = probeTypeIndex + CommonConstants.INT_SIZE;
+ pidIndex = probeSubTypeIndex + CommonConstants.INT_SIZE;
+ tidIndex = pidIndex + CommonConstants.INT_SIZE;
+ cpuNumIndex = tidIndex + CommonConstants.INT_SIZE;
+ argsIndex = cpuNumIndex + CommonConstants.INT_SIZE;
+ break;
+ case AnalyzerConstants.MSG_DATA_FUNCTION_EXIT:
+ pidIndex = 0;
+ tidIndex = pidIndex + CommonConstants.INT_SIZE;
+ pcAddrIndex = tidIndex + CommonConstants.INT_SIZE;
+ cpuNumIndex = pcAddrIndex + CommonConstants.LONG_SIZE;
+ returnIndex = cpuNumIndex + CommonConstants.INT_SIZE;
+ break;
+ case AnalyzerConstants.MSG_DATA_CONTEXT_SWITCH_ENTRY:
+ case AnalyzerConstants.MSG_DATA_CONTEXT_SWITCH_EXIT:
+ pcAddrIndex = 0;
+ pidIndex = pcAddrIndex + CommonConstants.LONG_SIZE;
+ tidIndex = pidIndex + CommonConstants.INT_SIZE;
+ cpuNumIndex = tidIndex + CommonConstants.INT_SIZE;
+ break;
+ case AnalyzerConstants.MSG_DATA_SAMPLE:
+ pidIndex = 0;
+ pcAddrIndex = pidIndex + CommonConstants.INT_SIZE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ public long getPcAddress() {
+ return ByteUtils.toLong(payload, pcAddrIndex);
+ }
+
+ public long getCallerPcAddress() {
+ return (callerPcAddrIndex < 0) ? -1 : ByteUtils.toLong(payload,
+ callerPcAddrIndex);
+ }
+
+ public int getProbeType() {
+ return (probeTypeIndex < 0) ? -1 : ByteUtils.toInt(payload,
+ probeTypeIndex);
+ }
+
+ public int getProbeSubType() {
+ return (probeSubTypeIndex < 0) ? -1 : ByteUtils.toInt(payload,
+ probeSubTypeIndex);
+ }
+
+ public int getPid() {
+ return (pidIndex < 0) ? -1 : ByteUtils.toInt(payload, pidIndex);
+ }
+
+ public int getTid() {
+ return (tidIndex < 0) ? -1 : ByteUtils.toInt(payload, tidIndex);
+ }
+
+ public int getCpuNum() {
+ return (cpuNumIndex < 0) ? -1 : ByteUtils.toInt(payload, cpuNumIndex);
+ }
+
+ public String getCallstack() {
+ return ((BasicDataMessage) basicData).getCallstack();
+ }
+
+ public String getArgs() {
+ return (argsIndex < 0) ? null : makeArgs(argsIndex);
+ }
+
+ public long getReturn() {
+ return (returnIndex < 0) ? -1 : ByteUtils.toLong(payload, returnIndex);
+ }
+
+ public void setCallstack(String callstack) {
+ // String[] temp = new String[log.length + 1];
+ // System.arraycopy(log, 0, temp, 0, log.length);
+ // temp[log.length] = callstack;
+ // log = temp;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class SceneData extends ProbeCommonData {
+ private int sceneNameIndex = 0;
+ private int formNameIndex = 0;
+ private int formPointerIndex = 0;
+ private int panelNameIndex = 0;
+ private int panelPointerIndex = 0;
+ private int transitionTimeIndex = 0;
+ private int userTransitionTimeIndex = 0;
+
+ public SceneData(BasicDataInterface data) {
+ super(data);
+ sceneNameIndex = getCommonColumnsSize();
+ formNameIndex = getStringLength(sceneNameIndex);
+ formPointerIndex = getStringLength(formNameIndex);
+ panelNameIndex = formPointerIndex + CommonConstants.LONG_SIZE;
+ panelPointerIndex = getStringLength(panelNameIndex);
+ transitionTimeIndex = panelPointerIndex + CommonConstants.LONG_SIZE;
+ userTransitionTimeIndex = transitionTimeIndex
+ + CommonConstants.INT_SIZE;
+ }
+
+ public String getSceneName() {
+ byte[] temp = new byte[formNameIndex - sceneNameIndex];
+ System.arraycopy(payload, sceneNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public String getFormName() {
+ byte[] temp = new byte[formPointerIndex - formNameIndex];
+ System.arraycopy(payload, formNameIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public long getFormPointer() {
+ return ByteUtils.toLong(payload, formPointerIndex);
+ }
+
+ public String getPanelName() {
+
+ byte[] temp = new byte[panelPointerIndex - panelNameIndex];
+ System.arraycopy(payload, panelNameIndex, temp, 0, temp.length);
+ return new String(temp);
+
+ }
+
+ public long getPanelPointer() {
+ return ByteUtils.toLong(payload, panelPointerIndex);
+ }
+
+ public int getTransitionTime() {
+ return ByteUtils.toInt(payload, transitionTimeIndex);
+ }
+
+ public int getUserTransitionTime() {
+ return ByteUtils.toInt(payload, userTransitionTimeIndex);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class ScreenShotData extends ProbeCommonData {
+ private int imageFilePathIndex = 0;
+ private int orientationIndex = 0;
+
+ public ScreenShotData(BasicDataInterface data) {
+ super(data);
+ imageFilePathIndex = getCommonColumnsSize();
+ orientationIndex = imageFilePathIndex + getStringLength(imageFilePathIndex);
+ }
+
+ public String getImageFilePath() {
+ byte[] temp = new byte[orientationIndex - imageFilePathIndex];
+ System.arraycopy(payload, imageFilePathIndex, temp, 0, temp.length);
+ return new String(temp);
+ }
+
+ public int getOrientation() {
+ return ByteUtils.toInt(payload, orientationIndex);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class SyncData extends ProbeCommonData {
+ private int syncValueIndex = 0;
+ private int syncTypeIndex = 0;
+ private int apiTypeIndex = 0;
+
+ public SyncData(BasicDataInterface data) {
+ super(data);
+
+ syncValueIndex = getCommonColumnsSize();
+ syncTypeIndex = syncValueIndex + CommonConstants.LONG_SIZE;
+ apiTypeIndex = syncTypeIndex + CommonConstants.INT_SIZE;
+ }
+
+ public long getSyncValue() {
+ return ByteUtils.toLong(payload, syncValueIndex);
+ }
+
+ public int getSyncType() {
+ return ByteUtils.toInt(payload, syncTypeIndex);
+ }
+
+ public int getApiType() {
+ return ByteUtils.toInt(payload, apiTypeIndex);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import static org.tizen.dynamicanalyzer.common.CommonConstants.FLOAT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class SystemData extends LogData {
+
+ public static final int PARSE_TYPE_THREAD = 1;
+ public static final int PARSE_TYPE_PROCESS = 2;
+
+ private int energyIndex = -1;
+ private int wifiIndex = -1;
+ private int btStatusIndex = -1;
+ private int gpsStatusIndex = -1;
+ private int brightnessIndex = -1;
+ private int cameraIndex = -1;
+ private int soundIndex = -1;
+ private int audioIndex = -1;
+ private int vibrationIndex = -1;
+ private int voltageIndex = -1;
+ private int rssiIndex = -1;
+ private int videoIndex = -1;
+ private int callIndex = -1;
+ private int dnetIndex = -1;
+ private int networkSendSizeIndex = -1;
+ private int networkReceiveSizeIndex = -1;
+ private int cpuFrequencyIndex = -1;
+ private int appCpuUsageIndex = -1;
+ private int cpuLoadIndex = -1;
+ private int virtualMemoryIndex = -1;
+ private int residentMemoryIndex = -1;
+ private int sharedMemoryIndex = -1;
+ private int pssMemoryIndex = -1;
+ private int totalAllocSizeIndex = -1;
+ private int systemMemoryTotalIndex = -1;
+ private int systemMemoryUsedIndex = -1;
+ private int totalUsedDriveIndex = -1;
+
+ private int threadCountIndex = -1;
+ private int threadLoadIndex = -1;
+
+ private int processCountIndex = -1;
+ private int processLoadIndex = -1;
+ private int diskReadSizeIndex = -1;
+ private int diskWriteSizeIndex = -1;
+
+ private int callAlphaIndex = -1;
+ private int rssiAlphaIndex = -1;
+
+ private String threadLoad = null;
+ private String processLoad = null;
+ private String cpuFrequency = null;
+ private String cpuLoad = null;
+
+ public SystemData(BasicDataInterface data) {
+ super(data);
+ int coreCount = DACommunicator.getSelectedDevice().getTargetInfo()
+ .getCpuCount();
+ energyIndex = 0;
+ wifiIndex = energyIndex + INT_SIZE;
+ btStatusIndex = wifiIndex + INT_SIZE;
+ gpsStatusIndex = btStatusIndex + INT_SIZE;
+ brightnessIndex = gpsStatusIndex + INT_SIZE;
+ cameraIndex = brightnessIndex + INT_SIZE;
+ soundIndex = cameraIndex + INT_SIZE;
+ audioIndex = soundIndex + INT_SIZE;
+ vibrationIndex = audioIndex + INT_SIZE;
+ voltageIndex = vibrationIndex + INT_SIZE;
+ rssiIndex = voltageIndex + INT_SIZE;
+ videoIndex = rssiIndex + INT_SIZE;
+ callIndex = videoIndex + INT_SIZE;
+ dnetIndex = callIndex + INT_SIZE;
+ cpuFrequencyIndex = dnetIndex + INT_SIZE;
+ appCpuUsageIndex = cpuFrequencyIndex + (FLOAT_SIZE * coreCount);
+ cpuLoadIndex = appCpuUsageIndex + FLOAT_SIZE;
+ virtualMemoryIndex = cpuLoadIndex + (FLOAT_SIZE * coreCount);
+ residentMemoryIndex = virtualMemoryIndex + INT_SIZE;
+ sharedMemoryIndex = residentMemoryIndex + INT_SIZE;
+ pssMemoryIndex = sharedMemoryIndex + INT_SIZE;
+ totalAllocSizeIndex = pssMemoryIndex + INT_SIZE;
+ systemMemoryTotalIndex = totalAllocSizeIndex + INT_SIZE;
+ systemMemoryUsedIndex = systemMemoryTotalIndex + LONG_SIZE;
+ totalUsedDriveIndex = systemMemoryUsedIndex + LONG_SIZE;
+ threadCountIndex = totalUsedDriveIndex + INT_SIZE;
+ threadLoadIndex = threadCountIndex + INT_SIZE;
+ processCountIndex = parseLoad(threadLoadIndex, PARSE_TYPE_THREAD);
+ processLoadIndex = processCountIndex + INT_SIZE;
+ diskReadSizeIndex =parseLoad(processLoadIndex, PARSE_TYPE_PROCESS);
+ diskWriteSizeIndex = diskReadSizeIndex + INT_SIZE;
+ networkSendSizeIndex = diskWriteSizeIndex + INT_SIZE;
+ networkReceiveSizeIndex = networkSendSizeIndex + INT_SIZE;
+
+ cpuFrequency = parseCpu(cpuFrequencyIndex);
+ cpuLoad = parseCpu(cpuLoadIndex);
+ }
+
+ private int parseLoad(int start, int type) {
+ int backPos = start - INT_SIZE;
+ int count = ByteUtils.toInt(payload, backPos);
+ StringBuffer outBuf = new StringBuffer();
+ for (int ii = 0; ii < count; ii++) {
+ int tid = ByteUtils.toInt(payload, start);
+ start += INT_SIZE;
+ outBuf.append(tid).append(CommonConstants.COMMA);
+ float f = ByteUtils.toFloat(payload, start);
+ outBuf.append(f);
+ start += FLOAT_SIZE;
+ if (ii + 1 != count) {
+ outBuf.append(',');
+ }
+ }
+ if (type == PARSE_TYPE_THREAD) {
+ threadLoad = outBuf.toString();
+ } else if (type == PARSE_TYPE_PROCESS) {
+ processLoad = outBuf.toString();
+ }
+ return start;
+ }
+
+ private String parseCpu(int start) {
+ int coreCount = DACommunicator.getSelectedDevice().getTargetInfo()
+ .getCpuCount();
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < coreCount; i++) {
+ float value = ByteUtils.toFloat(payload, start);
+ start += FLOAT_SIZE;
+ buffer.append(value);
+ if (i + 1 != coreCount) {
+ buffer.append(',');
+ }
+ }
+ return buffer.toString();
+ }
+
+ public int getEnergy() {
+ return ByteUtils.toInt(payload, energyIndex);
+ }
+
+ public int getWiFiStatus() {
+ return ByteUtils.toInt(payload, wifiIndex);
+ }
+
+ public int getBlutToothStatus() {
+ return ByteUtils.toInt(payload, btStatusIndex);
+ }
+
+ public int getGPSStatus() {
+ return ByteUtils.toInt(payload, gpsStatusIndex);
+ }
+
+ public int getBrightnessStatus() {
+ return ByteUtils.toInt(payload, brightnessIndex);
+ }
+
+ public int getCameraStatus() {
+ return ByteUtils.toInt(payload, cameraIndex);
+ }
+
+ public int getSoundStatus() {
+ return ByteUtils.toInt(payload, soundIndex);
+ }
+
+ public int getAudioStatus() {
+ return ByteUtils.toInt(payload, audioIndex);
+ }
+
+ public int getVibrationStatus() {
+ return ByteUtils.toInt(payload, vibrationIndex);
+ }
+
+ public int getVoltageStatus() {
+ return ByteUtils.toInt(payload, voltageIndex);
+ }
+
+ public int getRSSIStatus() {
+ return ByteUtils.toInt(payload, rssiIndex);
+ }
+
+ public int getVideoStatus() {
+ return ByteUtils.toInt(payload, videoIndex);
+ }
+
+ public int getCallStatus() {
+ return ByteUtils.toInt(payload, callIndex);
+ }
+
+ public int getDNetStatus() {
+ return ByteUtils.toInt(payload, dnetIndex);
+ }
+
+ public int getCallAlphaStatus() {
+ return ByteUtils.toInt(payload, callAlphaIndex);
+ }
+
+ public int getRssiAlphaStatus() {
+ return ByteUtils.toInt(payload, rssiAlphaIndex);
+ }
+
+ public String getCpuFrequency() {
+ return cpuFrequency;
+ }
+
+ public float getAppCpuUsage() {
+ return ByteUtils.toFloat(payload, appCpuUsageIndex);
+ }
+
+ public String getCpuLoad() {
+ return cpuLoad;
+ }
+
+ public int getVirtualMemory() {
+ return ByteUtils.toInt(payload, virtualMemoryIndex);
+ }
+
+ public int getResidentMemory() {
+ return ByteUtils.toInt(payload, residentMemoryIndex);
+ }
+
+ public int getSharedMemory() {
+ return ByteUtils.toInt(payload, sharedMemoryIndex);
+ }
+
+ public int getPSSMemory() {
+ return ByteUtils.toInt(payload, pssMemoryIndex);
+ }
+
+ public int getTotalAllocSize() {
+ return ByteUtils.toInt(payload, totalAllocSizeIndex);
+ }
+
+ public long getTotalSystemMemory() {
+ return ByteUtils.toLong(payload, systemMemoryTotalIndex);
+ }
+
+ public long getUsedSystemMemory() {
+ return ByteUtils.toLong(payload, systemMemoryUsedIndex);
+ }
+
+ public int getTotalUsedDrive() {
+ return ByteUtils.toInt(payload, totalUsedDriveIndex);
+ }
+
+ public int getThreadCount() {
+ return ByteUtils.toInt(payload, threadCountIndex);
+ }
+
+ public String getThreadLoad() {
+ return threadLoad;
+ }
+
+ public int getProcessCount() {
+ return ByteUtils.toInt(payload, processCountIndex);
+ }
+
+ public String getProcessLoad() {
+ return processLoad;
+ }
+
+ public int getNetworkSendSize() {
+ return ByteUtils.toInt(payload, networkSendSizeIndex);
+ }
+
+ public int getNetworkReceiveSize() {
+ return ByteUtils.toInt(payload, networkReceiveSizeIndex);
+ }
+
+ public int getCallAlpha() {
+ return -1;
+ }
+
+ public int getRssiAlpha() {
+ return -1;
+ }
+
+ public int getDISKReadSize() {
+ return ByteUtils.toInt(payload, diskReadSizeIndex);
+ }
+
+ public int getDISKWriteSize() {
+ return ByteUtils.toInt(payload, diskWriteSizeIndex);
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class ThreadData extends ProbeCommonData {
+ private int pThreadIdIndex = 0;
+ private int ospThreadIdIndex = 0;
+ private int threadTypeIndex = 0;
+ private int apiTypeIndex = 0;
+
+ public ThreadData(BasicDataInterface data) {
+ super(data);
+ pThreadIdIndex = getCommonColumnsSize();
+ ospThreadIdIndex = pThreadIdIndex + CommonConstants.LONG_SIZE;
+ threadTypeIndex = ospThreadIdIndex + CommonConstants.LONG_SIZE;
+ apiTypeIndex = threadTypeIndex + CommonConstants.INT_SIZE;
+ }
+
+ public long getPThreadId() {
+ return ByteUtils.toLong(payload, pThreadIdIndex);
+ }
+
+ public long getOspThreadId() {
+ return ByteUtils.toLong(payload, ospThreadIdIndex);
+ }
+
+ public int getThreadType() {
+ return ByteUtils.toInt(payload, threadTypeIndex);
+ }
+
+ public int getApiType() {
+ return ByteUtils.toInt(payload, apiTypeIndex);
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class UIEventData extends ProbeCommonData {
+
+ private int eventTypeIndex = 0;
+ private int detailTypeIndex = 0;
+ private int xIndex = 0;
+ private int yIndex = 0;
+ private int info1Index = 0;
+ private int info2Index = 0;
+
+ private int logNum = 0;
+
+ public UIEventData(BasicDataInterface data) {
+ super(data);
+ eventTypeIndex = getCommonColumnsSize();
+ detailTypeIndex = eventTypeIndex + CommonConstants.INT_SIZE;
+ xIndex = detailTypeIndex + CommonConstants.INT_SIZE;
+ yIndex = xIndex + CommonConstants.INT_SIZE;
+ info1Index = yIndex + CommonConstants.INT_SIZE;
+ info2Index = info1Index + CommonConstants.INT_SIZE;
+ }
+
+ public int getEventType() {
+ return ByteUtils.toInt(payload, eventTypeIndex);
+ }
+
+ public int getDetailType() {
+ return ByteUtils.toInt(payload, detailTypeIndex);
+ }
+
+ public int getX() {
+ return ByteUtils.toInt(payload, xIndex);
+ }
+
+ public int getY() {
+ return ByteUtils.toInt(payload, yIndex);
+ }
+
+ public int getInfo1() {
+ return ByteUtils.toInt(payload, info1Index);
+ }
+
+ public int getInfo2() {
+ return ByteUtils.toInt(payload, info2Index);
+ }
+
+ @Override
+ public int getLogNum() {
+ return logNum++;
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class UserFunctionData extends ProbeCommonData {
+
+ private int lowPcIndex = -1;
+ private int highPcIndex = -1;
+ private int typeIndex = -1;
+ private int elapsedTimeIndex = -1;
+ private int pcAddrIndex = -1;
+
+ public UserFunctionData(BasicDataInterface data) {
+ super(data);
+ lowPcIndex = getCommonColumnsSize();
+ highPcIndex = lowPcIndex + LONG_SIZE;
+ typeIndex = highPcIndex + LONG_SIZE;
+ elapsedTimeIndex = typeIndex + INT_SIZE;
+ pcAddrIndex = elapsedTimeIndex + LONG_SIZE;
+ }
+
+ public long getLowPc() {
+ return ByteUtils.toLong(payload, lowPcIndex);
+ }
+
+ public long getHighPc() {
+ return ByteUtils.toLong(payload, highPcIndex);
+ }
+
+ public int getType() {
+ return ByteUtils.toInt(payload, typeIndex);
+ }
+
+ public long getElapsedTime() {
+ return ByteUtils.toLong(payload, elapsedTimeIndex);
+ }
+
+ public long getPCAddress() {
+ return ByteUtils.toLong(payload, pcAddrIndex);
+ }
+
+}
package org.tizen.dynamicanalyzer.ui.common;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
private DATimeline timeline;
private double baseTime = TimelineConstants.NOT_INITED;
- private final int SELECTION_MARKER_INDEX = 0; // FIXME
+ private static final int SELECTION_MARKER_INDEX = 0; // FIXME
public TimelineChartMouseEventListener(DAContextMenu menu,
DATimeline timeline) {
DAContextMenuItem analysisItem = itemList.get(3);
DAContextMenuItem clearItem = itemList.get(4);
+ if(ToolbarArea.getInstance() == null) {
+ System.out.println("toolbar area is null");//$NON-NLS-1$
+ return;
+ }
+
if (eventTime * TimelineConstants.MEGA <= ToolbarArea.getInstance()
.getTime()) {
startItem.setButtonEnabled(true);
}
if (plot instanceof DAUIEventChartPlot) {
- double newYPosRatio = (double) e.y
- / ((Canvas) e.widget).getSize().y;
- int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
- .size());
- int startIndex = chart.getSeriesList().get(seriesIndex)
- .getNextIndexByXvalue(intervalMarker.getStartVal());
- int endIndex = chart.getSeriesList().get(seriesIndex)
- .getPrevIndexByXvalue(intervalMarker.getEndVal());
+ List<Integer> startIndexList = new ArrayList<Integer>();
+ List<Integer> endIndexList = new ArrayList<Integer>();
+
+ for (DAChartSeries chartSeries : chart.getSeriesList()) {
+ int startIndex = chartSeries
+ .getNextIndexByXvalue(intervalMarker.getStartVal());
+ int endIndex = chartSeries
+ .getPrevIndexByXvalue(intervalMarker.getEndVal());
+
+ startIndexList.add(startIndex);
+ endIndexList.add(endIndex + 1);
+ }
DAContextMenuItem eventListItem = menu.getItems().get(
menu.getItems().size() - 1);
((UIEventChartContextMenuItem) eventListItem)
- .setSeriesIndex(seriesIndex);
+ .setChartSeriesList(chart.getSeriesList());
((UIEventChartContextMenuItem) eventListItem)
- .setEventListStartIndex(startIndex);
+ .setStartIndexList(startIndexList);
((UIEventChartContextMenuItem) eventListItem)
- .setEventListEndIndex(endIndex);
+ .setEndIndexList(endIndexList);
eventListItem.setEnabled(true);
}
double oldYPosRatio = tooltip.getYPosRatio();
double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
- if (oldYPosRatio != newYPosRatio) {
+ if (Double.compare(oldYPosRatio, newYPosRatio) != 0) {
if (newYPosRatio < 0) {
newYPosRatio = 0.01;
} else if (newYPosRatio >= 1) {
double oldYPosRatio = tooltip.getYPosRatio();
double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
- if (oldYPosRatio != newYPosRatio) {
+ if (Double.compare(oldYPosRatio, newYPosRatio) != 0) {
tooltip.setYPosRatio(newYPosRatio);
}
package org.tizen.dynamicanalyzer.ui.common;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.contextMenu.ContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
public class UIEventChartContextMenuItem extends DAContextMenuItem {
- private int seriesIndex = -1;
- private int eventListStartIndex = -1;
- private int eventListEndIndex = -1;
+ private List<DAChartSeries> chartSeriesList;
+ private List<Integer> startIndexList;
+ private List<Integer> endIndexList;
public UIEventChartContextMenuItem(ContextMenu menu) {
super(menu);
}
- public int getSeriesIndex() {
- return seriesIndex;
+ public List<DAChartSeries> getChartSeriesList() {
+ return chartSeriesList;
}
- public void setSeriesIndex(int seriesIndex) {
- this.seriesIndex = seriesIndex;
+ public void setChartSeriesList(List<DAChartSeries> chartSeriesList) {
+ this.chartSeriesList = chartSeriesList;
}
- public int getEventListStartIndex() {
- return eventListStartIndex;
+ public List<Integer> getStartIndexList() {
+ return startIndexList;
}
- public void setEventListStartIndex(int startIndex) {
- eventListStartIndex = startIndex;
+ public void setStartIndexList(List<Integer> startIndexList) {
+ this.startIndexList = startIndexList;
}
- public int getEventListEndIndex() {
- return eventListEndIndex;
+ public List<Integer> getEndIndexList() {
+ return endIndexList;
}
- public void setEventListEndIndex(int endIndex) {
- eventListEndIndex = endIndex;
+ public void setEndIndexList(List<Integer> endIndexList) {
+ this.endIndexList = endIndexList;
}
}
\ No newline at end of file
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadChartView;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class FileApiListTable extends DAApiListTableComposite {
private DAChartBoard chartBoard = null;
-
+
public FileApiListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
table.addSelectionListener(new SelectionListener() {
long endTime = 0;
DATableDataFormat dataFormat;
- String time;
+ long itemTime;
for (int i = 0; i < items.length; i++) {
dataFormat = (DATableDataFormat) items[i].getData();
- time = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
- long itemTime = Long.parseLong(time);
+ itemTime = dataFormat.getLogData().getTime();
if (0 == startTime) {
startTime = itemTime;
}
protected List<TableInput> makeTableInput() {
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getViewMap().get(FileApiListView.ID);
- if (!(view instanceof FileApiListView)) {
- return null;
- }
+
FileChartData data = view.getPageData();
if (null == data) {
return null;
FileChartDataEvent content;
for (int i = 0; i < contents.size(); i++) {
content = contents.get(i);
- List<String> contentTemp = content.getContents();
+ FileData contentTemp = content.getContents();
List<String> contentText = new ArrayList<String>();
- String seq = contentTemp
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- contentText.add(0, seq);
- contentText.add(Formatter.toTimeFormat(contentTemp
- .get(LogCenterConstants.TIME_INDEX)));
- contentText.add(contentTemp.get(LogCenterConstants.APINAME_INDEX));
- contentText
- .add(contentTemp.get(LogCenterConstants.INPUTPARM_INDEX));
- contentText
- .add(contentTemp.get(LogCenterConstants.THREAD_ID_INDEX));
- contentText.add(contentTemp.get(LogCenterConstants.RETURN_INDEX));
- String errMsg = ErrorCodeManager.getInatance().getErrorCode(
- contentTemp.get(LogCenterConstants.ERROR_INDEX));
+ int seq = contentTemp.getSeq();
+ contentText.add(0, Integer.toString(seq));
+ long time = contentTemp.getTime();
+ contentText.add(Formatter.toTimeFormat(time));
+ contentText.add(contentTemp.getApiName());
+ contentText.add(contentTemp.getArgs());
+ contentText.add(Integer.toString(contentTemp.getTid()));
+ contentText.add(Long.toString(contentTemp.getReturn()));
+ String errMsg = ErrorCodeManager.getInatance()
+ .getErrorCode(contentTemp.getErrno()).name();
if (null == errMsg) {
errMsg = "undefined error code"; //$NON-NLS-1$
}
contentText.add(errMsg);
- contentText.add(contentTemp
- .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX));
+ contentText.add(Integer.toString(contentTemp.getFileSize()));
DATableDataFormat tableData = new DATableDataFormat(
- contentTemp.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- tableData.getData().addAll(contentTemp);
+ contentTemp.getSeq());
+ // contentTemp.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+ tableData.setLogData(contentTemp);
TableInput tableInput = new TableInput();
tableInput.setText(contentText);
tableInput.setData(tableData);
input.add(tableInput);
- long time = Long.parseLong(contentTemp
- .get(LogCenterConstants.TIME_INDEX));
if (time >= rangeStartTime && time <= rangeEndTime) {
tableInput.setInRange(true);
}
return input;
}
-
+
private DAChartBoard getChartBoard() {
if (chartBoard == null) {
- return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
- ThreadChartView.ID).getControl());
+ chartBoard = (DAChartBoard) (AnalyzerManager.getCurrentPage()
+ .getView(FileChartView.ID).getControl());
}
return chartBoard;
}
protected void actionSetStartEnd(int type) {
GridItem item = table.getItem(mousePoint);
if (null != item) {
- List<String> data = ((DATableDataFormat) item.getData()).getData();
- String time = data.get(LogCenterConstants.TIME_INDEX);
- long inputTime = -1;
- try {
- inputTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
+ FileData data = (FileData)((DATableDataFormat) item.getData()).getLogData();
+ long time = data.getTime();
+ double startTime = -1;
+ double endTime = -1;
+ DAChartBoard board = getChartBoard();
+
if (type == START_TIME) {
- rangeDataManager.setMarkerStartTime(inputTime);
- getChartBoard().setTimelineMarkerStartTime(
- inputTime / TimelineConstants.MEGA);
+ rangeDataManager.setMarkerStartTime(time);
+ startTime = time / TimelineConstants.MEGA;
+ endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
} else if (type == END_TIME) {
- rangeDataManager.setMarkerEndTime(inputTime);
- getChartBoard().setTimelineMarkerEndTime(
- inputTime / TimelineConstants.MEGA);
+ rangeDataManager.setMarkerEndTime(time);
+ endTime = time / TimelineConstants.MEGA;
+ startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
}
+
+ board.setTimelineMarkerStartTime(startTime);
+ board.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
}
}
}
package org.tizen.dynamicanalyzer.ui.file;
-import java.util.List;
-
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
long newAnalysisEndTime = 0;
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- newAnalysisStartTime = RangeDataManager.getInstance().getAnalysisStartTime();
- newAnalysisEndTime = RangeDataManager.getInstance().getAnalysisEndTime();
+ newAnalysisStartTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
+ newAnalysisEndTime = RangeDataManager.getInstance()
+ .getAnalysisEndTime();
} else {
newAnalysisStartTime = 0;
newAnalysisEndTime = 0;
}
@Override
- public void setSelection(List<String> data) {
- if (null == data || data.isEmpty()) {
+ public void setSelection(LogData data) {
+ if (null == data) {
return;
}
- String seq = data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ int seq = data.getSeq();
tableComp.updateTable();
int nSize = tableComp.getTable().getItemCount();
for (int ii = 0; ii < nSize; ii++) {
- if (tableComp.getTable().getItem(ii).getText(0).equals(seq)) {
+ if (tableComp.getTable().getItem(ii).getText(0)
+ .equals(Integer.toString(seq))) {
tableComp.getTable().setSelection(ii);
tableComp
.getTable()
tableComp.updateTable();
}
}
- String logTime = data.get(LogCenterConstants.TIME_INDEX);
- long selectedTime = Long.parseLong(logTime);
+ long selectedTime = data.getTime();
DASelectionData selData = new DASelectionData(FileApiListView.ID,
selectedTime, selectedTime,
tableComp.getTable().getSelection(), tableComp.getTable());
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
private DAChartSeries accessSeries;
private DAChartSeries statueSeries;
- private String fd = AnalyzerLabels.EMPTY_STRING;
+ private int fd = -1;
private String filePath = AnalyzerLabels.EMPTY_STRING;
private boolean isClosedFile = true;
private boolean isFailedAPI = false;
// for Detail View Data
- private List<FailedData> failedData = null;
+ private List<FailedData2> failedData = null;
private long fileSize = 0;
private long readSize = 0;
private long writeSize = 0;
private int lastAccessIndexForParent = 0;
- public FileChartData(String filePath, String Fd, boolean isRoot) {
+ public FileChartData(String filePath, int Fd, boolean isRoot) {
setFilePath(filePath);
- setFD(Fd);
+ setFd(Fd);
}
public void pushChild(FileChartData data) {
}
}
- public List<FailedData> getFailedData() {
+ public List<FailedData2> getFailedData() {
if (null == failedData) {
- failedData = new ArrayList<FailedData>();
+ failedData = new ArrayList<FailedData2>();
}
return failedData;
}
- public List<String> getFailedRelations() {
- List<String> output = new ArrayList<String>();
+ public List<Integer> getFailedRelations() {
+ List<Integer> output = new ArrayList<Integer>();
int size = getFailedData().size();
for (int i = 0; i < size; i++) {
- FailedData ffd = failedData.get(i);
- String seq = ffd
- .getLogData(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ FailedData2 ffd = failedData.get(i);
+ int seq = ffd.getSeq();
output.add(seq);
}
return output;
return children;
}
- public String getFD() {
+ public int getFD() {
return fd;
}
- public void setFD(String data) {
+ public void setFd(int data) {
this.fd = data;
}
FileChartData ret;
for (int i = 0; i < size; i++) {
ret = children.get(i);
- if ((ret.getFD().trim().equals(event.getFd()))
+ if ((ret.getFD() == event.getFd())
&& (ret.isClosed(event) == false)) {
return ret;
}
if (isParent() && (event == null)) {
for (int i = 0; i < size; i++) {
if ((!children.get(i).isClosed(null))
- && (!children.get(i).getFD().contains("-1"))) {
+ && (children.get(i).getFD() != -1)) {
setNotClosedFileStatus();
break;
}
package org.tizen.dynamicanalyzer.ui.file;
-import java.util.ArrayList;
-import java.util.List;
-
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
public class FileChartDataEvent {
- private List<String> contents;
- private FailedData failedData = null;
+ private FileData contents;
+ private FailedData2 failedData = null;
- private String FD = AnalyzerLabels.EMPTY_STRING;
+ private int fd = -1;
private String filePath = AnalyzerLabels.EMPTY_STRING;
private int apiType = -1;
private String tooltip = null;
- public FileChartDataEvent(String filePath, String Fd, double time,
- String tooltip, List<String> contents) {
+ public FileChartDataEvent(String filePath, int fd, long time,
+ String tooltip, FileData contents) {
setFilePath(filePath);
- setFd(Fd);
+ setFd(fd);
setLogTime(time);
setContents(contents);
setTooltipContent(tooltip);
}
- public FileChartDataEvent(List<String> contents) {
+ public FileChartDataEvent(FileData contents) {
setContents(contents);
}
- public List<String> getContents() {
- if (null == contents) {
- contents = new ArrayList<String>();
- }
+ public FileData getContents() {
return contents;
}
- public void setContents(List<String> contents) {
+ public void setContents(FileData contents) {
this.contents = contents;
}
- public String getFd() {
- return FD;
+ public int getFd() {
+ return fd;
}
- public void setFd(String fd) {
- this.FD = fd;
+ public void setFd(int fd) {
+ this.fd = fd;
}
public boolean isFailedAPI() {
return this.writeSize;
}
- public void setFailedData(FailedData data) {
+ public void setFailedData(FailedData2 data) {
failedData = data;
}
- public FailedData getFailedData() {
+ public FailedData2 getFailedData() {
return failedData;
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogListQueue;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public class FileChartManager implements Runnable {
public void run() {
LogListQueue logListQueue = getInstance().getLogListQueue();
while (!AnalyzerManager.isExit()) {
- List<List<String>> logs = logListQueue.getFirst();
+ List<LogData> logs = logListQueue.getFirst();
if (null == logs) {
break;
}
}
}
- public int[] getParentChartIndex(String seq) {
+ public int[] getParentChartIndex(int seq) {
int parentChartIndex = -1;
FileChartData chartData = null;
List<FileChartData> fileChartDataLow = FileChartManager.getInstance()
return new int[] { 0, 0 };
}
- public int getChildChartIndex(int parentChartIndex, String seq) {
+ public int getChildChartIndex(int parentChartIndex, int seq) {
List<FileChartData> fileChartDataLow = FileChartManager.getInstance()
.getFileDataMaker().getFileChartLow();
List<FileChartData> childData = fileChartDataLow.get(parentChartIndex)
return 0;
}
- public boolean isEqulasSeq(FileChartData chartData, String seq) {
+ public boolean isEqulasSeq(FileChartData chartData, int seq) {
for (int j = 0; j < chartData.getContents().size(); j++) {
if (chartData.getContents().get(j).getContents()
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX).equals(seq)) {
+ .getSeq() == seq) {
return true;
}
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
double startTime = (double) start / TimelineConstants.MEGA;
double endTime = (double) end / TimelineConstants.MEGA;
double middleTime = (startTime + endTime) / 2.0;
- if (endTime == startTime) {
+ if (start == end) {
middleTime = startTime;
}
}
@Override
- public void setSelection(List<String> data) {
- if (null == data || data.isEmpty()) {
+ public void setSelection(LogData data) {
+ if (null == data) {
return;
}
- String seq = data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ int seq = data.getSeq();
int selectedIndex[] = FileChartManager.getInstance()
.getParentChartIndex(seq);
fileChart.selectItem(selectedIndex[0], FileChartManager.getInstance()
@Override
public void updateLog(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_RESOURCE);
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_FILE);
if (null == logs || logs.getLogs().size() == 0) {
return;
}
- List<List<String>> inputs = logs.getCloneLogs();
+ List<LogData> inputs = logs.getCloneLogs();
FileChartManager.getInstance().getLogListQueue().putLog(inputs);
}
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
private List<FileChartData> rows = new ArrayList<FileChartData>();
private List<FileChartDataEvent> fileEventQueue = new ArrayList<FileChartDataEvent>();
private List<FileChartDataEvent> fileEventWarningQueue = new ArrayList<FileChartDataEvent>();
- private HashMap<String, String> findPathHashMap = new HashMap<String, String>();
+ private HashMap<Integer, String> findPathHashMap = new HashMap<Integer, String>();
private int timeLineFileChartFDCount = 0;
private FailedChecker failedChecker = null;
- @SuppressWarnings("unused")
- private LeakDetector leakDetector = null;
private WarningChecker warningChecker = null;
public FileDataMaker(FailedChecker failedChecker,
LeakDetector leakDetector, WarningChecker warningChecker) {
this.failedChecker = failedChecker;
- this.leakDetector = leakDetector;
this.warningChecker = warningChecker;
}
return rows;
}
- private boolean isOpenMainLog(List<String> input) {
- String filePath = input
- .get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+ private boolean isOpenMainLog(FileData input) {
+ String filePath = input.getFilePath();
if (filePath.contains(CommonConstants.SLASH)) {
String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
String strApiFilePath = new String(
return false;
}
- private boolean isPrintLog(List<String> input) {
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
+ private boolean isPrintLog(FileData input) {
+ String apiName = input.getApiName();
if (apiName.contains("print")) {//$NON-NLS-1$
return true;
}
return false;
}
- public void makeData(List<List<String>> inputs) {
+ public void makeData(List<LogData> inputs) {
int size = inputs.size();
for (int i = 0; i < size; i++) {
- List<String> input = inputs.get(i);
-
- if (AnalyzerUtil.isInternal(input, false)) {
+ FileData input = (FileData) inputs.get(i);
+ if (AnalyzerUtil.isInternal(input)) {
continue;
}
continue;
}
- String fdType = input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
+ // String fdType =
+ // input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
// socket
- int type = Integer.parseInt(fdType);
+ int type = input.getFDType();
if (type == 1 || type == 2) {
continue;
}
- String fdApiType = input
- .get(LogCenterConstants.RESOURCE_FDAPITYPE_INDEX);
- String path = input
- .get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
- String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
-
- String err = input.get(LogCenterConstants.ERROR_INDEX);
- long errno = Long.parseLong(err);
-
- String name = input.get(LogCenterConstants.APINAME_INDEX);
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX));
- // wrong log
- if (fd.trim().equals(AnalyzerLabels.EMPTY_STRING)) {
- // System.out.println("wrong fd : " + fd + " input : " + input);
- continue;
- }
- if (!fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_OPEN))) {
+ int fdApiType = input.getFDApiType();
+ String path = input.getFilePath();
+ int fd = input.getFDValue();
+
+ long errno = input.getErrno();
+
+ String name = input.getApiName();
+ long time = input.getTime();
+
+ if (fdApiType != LogCenterConstants.FD_API_TYPE_OPEN) {
path = AnalyzerLabels.EMPTY_STRING;
}
FileChartDataEvent event = new FileChartDataEvent(path, fd, time,
// error check
if (errno != 0) {
- FailedData ffd = new FailedData(input);
+ FailedData2 ffd = new FailedData2(input);
event.setFailedData(ffd);
this.failedChecker.getFailedList().add(ffd);
event.setFailedAPI();
continue;
}
- if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_OPEN))) {
+ if (fdApiType == LogCenterConstants.FD_API_TYPE_OPEN) {
event.setApiType(LogCenterConstants.FD_API_TYPE_OPEN);
checkDuplicateOpen(event);
if (errno == 0) {
timeLineFileChartFDCount++;
FileChart.getInstance().setFDCount(1, time);
}
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_CLOSE))) {
+ } else if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
event.setApiType(LogCenterConstants.FD_API_TYPE_CLOSE);
if (errno == 0) {
timeLineFileChartFDCount--;
}
}
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_READ_START))
- || fdApiType
- .equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_WRITE_START))) {
- String rwRetuenSize = input
- .get(LogCenterConstants.RETURN_INDEX);
- long rwRetrun = Long.parseLong(rwRetuenSize);
+ } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START
+ || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START) {
+ long rwRetrun = input.getReturn();
if (rwRetrun < 0) {
rwRetrun = 0;
}
- if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_READ_START))) {
+ if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START) {
event.setReadSize(rwRetrun);
event.setApiType(LogCenterConstants.FD_API_TYPE_READ_START);
FileChart.getInstance().setReadByte((int) rwRetrun, time);
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_WRITE_START))) {
+ } else if (fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START) {
- String strFileSize = input
- .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
- if (strFileSize.equals("?") == false) {//$NON-NLS-1$
- long fileSize = Long.parseLong(strFileSize);
- event.setFileSize(fileSize);
- }
+ // String strFileSize = input
+ // .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
+ // if (strFileSize.equals("?") == false) {//$NON-NLS-1$
+ // long fileSize = Long.parseLong(strFileSize);
+ // event.setFileSize(fileSize);
+ // }
event.setFileSize(rwRetrun);
event.setWriteSize(rwRetrun);
event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_START);
FileChart.getInstance().setWriteByte((int) rwRetrun, time);
}
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_READ_END))) {
+ } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END) {
event.setApiType(LogCenterConstants.FD_API_TYPE_READ_END);
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_WRITE_END))) {
+ } else if (fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
} else {
}
fileEventQueue.add(event);
fileEventWarningQueue.add(event);
- if (fdApiType.equals(Integer
- .toString(LogCenterConstants.FD_API_TYPE_CLOSE))) {
+ if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
checkWithoutUsing(event);
}
}
if (!warningChecker.isChecked(data.getFilePath(),
WarningCase.DUPLICATE_OPEN.getType())) {
WarningData wData = new WarningData(
- LogCenterConstants.LOG_RESOURCE,
WarningCase.DUPLICATE_OPEN.getType(),
data.getContents(), data.getFilePath());
warningChecker.getWarningData().add(wData);
int nAPICount = 0;
for (int i = 0; i < fileEventWarningQueue.size(); i++) {
FileChartDataEvent event = fileEventWarningQueue.get(i);
- if ((event.getFd().equals(data.getFd()))) {
+ if ((event.getFd() == data.getFd())) {
nAPICount++;
if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
data.setFilePath(event.getFilePath());
if (!warningChecker.isChecked(data.getFilePath(),
WarningCase.WITHOUT_USING.getType())) {
WarningData wData = new WarningData(
- LogCenterConstants.LOG_RESOURCE,
WarningCase.WITHOUT_USING.getType(),
data.getContents(), data.getFilePath());
warningChecker.getWarningData().add(wData);
initFileChart(chart, true);
} else {
DAChartBoardItem parentItem = parent.getItem();
- item = new DAChartBoardItem(parentItem, sync.getFD());
+ item = new DAChartBoardItem(parentItem, Integer.toString(sync
+ .getFD()));
chart = item.getChart();
initFileChart(chart, false);
}
return true;
}
- private FileChartData findParent(String filePath, String fd) {
+ private FileChartData findParent(String filePath, int fd) {
filePath = findPathHashMap.get(fd);
int size = rows.size();
FileChartData returnData = null;
}
}
- e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_SIZE
- + Long.toString(fileSize), x, y += fontHeight);
+ e.gc.drawString(
+ FilePageLabels.FILE_DETAILS_TOTAL_SIZE
+ + Long.toString(fileSize), x, y += fontHeight);
e.gc.drawString(
FilePageLabels.FILE_DETAILS_READ_SIZE
- + Long.toString(readSize), x,
- y += fontHeight);
- e.gc.drawString(FilePageLabels.FILE_DETAILS_WRITE_SIZE
- + Long.toString(writeSize), x, y += fontHeight);
+ + Long.toString(readSize), x, y += fontHeight);
+ e.gc.drawString(
+ FilePageLabels.FILE_DETAILS_WRITE_SIZE
+ + Long.toString(writeSize), x, y += fontHeight);
e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
- + Formatter.toTimeFormat(Long.toString(totalUseTime)),
- x, y += fontHeight);
+ + Formatter.toTimeFormat(totalUseTime), x,
+ y += fontHeight);
e.gc.drawString(
FilePageLabels.FILE_DETAILS_API_COUNT
+ Integer.toString(apiCount), x,
private void updateData() {
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getViewMap().get(FileApiListView.ID);
- if (!(view instanceof FileApiListView)) {
- return;
- }
FileChartData selectData = view.getPageData();
if (null == selectData) {
fileSize = selectData.getFileSize();
readSize = selectData.getReadSize();
writeSize = selectData.getWriteSize();
- totalUseTime = (long)selectData.getFileTotalUseTime();
+ totalUseTime = (long) selectData.getFileTotalUseTime();
apiCount = selectData.getApiCount();
failedApiCount = selectData.getFailedApiCount();
canvas.redraw();
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
public class CallStackManager {
private HashMap<Integer, List<CallStackUnit>> userCallstackByTidMap = new HashMap<Integer, List<CallStackUnit>>();
private HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap = new HashMap<Integer, CallStackManager.DuplicateUserCall>();
- public void makeUserCallstack(String[] input, ProfileDataMaker profiler) {
+ public void makeUserCallstack(UserFunctionData log,
+ ProfileDataMaker profiler) {
HashMap<Long, CallStackUnit> addrMap = getCallStackApiByAddrMap();
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
String binPath = AnalyzerManager.getProject().getBinaryPath();
if (null == binPath || binPath.isEmpty()) {
return;
}
- String strSelfAddr = input[LogCenterConstants.PCADDR_INDEX];
- String strCallerAddr = input[LogCenterConstants.CALLER_PCADDR_INDEX];
- String strSeq = input[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- String strTid = input[LogCenterConstants.THREAD_ID_INDEX];
+ String strSelfAddr = Long.toString(log.getPCAddress());
+ String strCallerAddr = Long.toString(log.getCallerPcAddr());
- int seq = Integer.parseInt(strSeq);
- int tid = Integer.parseInt(strTid);
+ int seq = log.getSeq();
+ int tid = log.getTid();
- long selfAddr = Long.parseLong(strSelfAddr);
- long callerAddr = Long.parseLong(strCallerAddr);
+ long selfAddr = log.getPCAddress();
+ long callerAddr = log.getCallerPcAddr();
CallStackData callstackData = new CallStackData(seq);
CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
}
// insert call count
- profiler.makeFupDataForCallTrace(selfCallstackUnit, input);
+ profiler.makeFupDataForCallTrace(selfCallstackUnit, log);
List<CallStackUnit> userCallstack = getUserCallstack(tid);
int size = userCallstack.size();
addrMap.put(callerAddr, callerCallstackUnit);
}
- String strEventType = input[LogCenterConstants.USER_FUNCTION_TYPE_INDEX];
- int eventType = Integer.parseInt(strEventType);
-
+ int eventType = log.getType();
if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER) {
if (size == 0) {
userCallstack.add(selfCallstackUnit);
} else {
- if (!AnalyzerManager.isInBinaryRange(strCallerAddr)) {
+ if (!AnalyzerManager.isInBinaryRange(callerAddr)) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL);
.println("makeUserCallstack : EXIT self is not the same as top of user callstack");
}
if (AnalyzerManager.isOsp()) {
- String apiName = input[LogCenterConstants.APINAME_INDEX];
+ // String apiName = input[LogCenterConstants.APINAME_INDEX];
+ String apiName = log.getApiName();
if (apiName.equals("OspMain")) { //$NON-NLS-1$
LogParser.setDropCallTraceLog(true);
}
}
}
- public void makeCallstackWithoutBacktrace(String[] input) {
+ public void makeCallstackWithoutBacktrace(LogData inputData) {
HashMap<Long, CallStackUnit> addrMap = getCallStackApiByAddrMap();
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
String binPath = AnalyzerManager.getProject().getBinaryPath();
if (null == binPath || binPath.isEmpty()) {
return;
}
- String strSeq = input[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- String strTid = input[LogCenterConstants.THREAD_ID_INDEX];
- String strCallerAddr = input[LogCenterConstants.CALLER_PCADDR_INDEX];
-
- int seq = Integer.parseInt(strSeq);
- int tid = Integer.parseInt(strTid);
- long callerAddr = 0;
- if (!strCallerAddr.isEmpty()) {
- callerAddr = Long.parseLong(strCallerAddr);
- } else {
+
+ ProbeCommonData log = (ProbeCommonData) inputData;
+ // String strSeq = input[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
+ // String strTid = input[LogCenterConstants.THREAD_ID_INDEX];
+ // String strCallerAddr = input[LogCenterConstants.CALLER_PCADDR_INDEX];
+
+ // int seq = Integer.parseInt(strSeq);
+ // int tid = Integer.parseInt(strTid);
+ int seq = log.getSeq();
+ int tid = log.getTid();
+ log.getCallerPcAddr();
+ // long callerAddr = 0;
+ long callerAddr = log.getCallerPcAddr();
+ // if (!strCallerAddr.isEmpty()) {
+ // callerAddr = Long.parseLong(strCallerAddr);
+ // } else {
+ // CallStackData callstackData = new CallStackData(seq);
+ // getCallStackDataBySeqMap().put(seq, callstackData);
+ // return;
+ // }
+ if (callerAddr < 0) {
CallStackData callstackData = new CallStackData(seq);
getCallStackDataBySeqMap().put(seq, callstackData);
return;
}
+ String strCallerAddr = Long.toString(callerAddr);
List<CallStackUnit> probeCallstack = new ArrayList<CallStackUnit>(
getUserCallstack(tid));
CallStackData callstackData = new CallStackData(seq);
- if ((size == 0) || (!AnalyzerManager.isInBinaryRange(strCallerAddr))) {
+ if ((size == 0) || (!AnalyzerManager.isInBinaryRange(callerAddr))) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL);
}
// check irregular enter/exit log (multiple logs from 1 function call)
- public boolean isIrregularUserCall(String[] input) {
+ public boolean isIrregularUserCall(UserFunctionData input) {
HashMap<Long, CallStackUnit> addrMap = getCallStackApiByAddrMap();
HashMap<Integer, DuplicateUserCall> dupUserCallMap = getDupUserCallByTidMap();
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
String binPath = AnalyzerManager.getProject().getBinaryPath();
if (null == binPath || binPath.isEmpty()) {
return false;
}
- String strSelfAddr = input[LogCenterConstants.PCADDR_INDEX];
- String strTid = input[LogCenterConstants.THREAD_ID_INDEX];
+ String strSelfAddr = Long.toString(input.getPCAddress());
- int tid = Integer.parseInt(strTid);
- long selfAddr = Long.parseLong(strSelfAddr);
+ int tid = input.getTid();
+ long selfAddr = input.getPCAddress();
CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
List<CallStackUnit> userCallstack = getUserCallstack(tid);
int size = userCallstack.size();
- String strEventType = input[LogCenterConstants.USER_FUNCTION_TYPE_INDEX];
- int eventType = Integer.parseInt(strEventType);
-
+ int eventType = input.getType();
if (size > 0) {
if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER) {
CallStackUnit topCallstackUnit = userCallstack.get(size - 1);
return false;
}
- public String getPCAddrBySeq(int seq) {
+ public long getPCAddrBySeq(int seq) {
HashMap<Integer, CallStackData> cdMap = getCallStackDataBySeqMap();
if (null == cdMap) {
- return null;
+ return -1;
}
CallStackData csd = cdMap.get(seq);
if (null == csd) {
- return null;
+ return -1;
}
List<Long> addrs = csd.getAddrs();
if (null == addrs || addrs.isEmpty()) {
- return null;
+ return -1;
}
- return Long.toString(addrs.get(0));
+ return addrs.get(0);
}
public void clear() {
functionStartAddress = addr;
this.originSymbol = symbol;
- functionName = ""; //$NON-NLS-1$
- offset = ""; //$NON-NLS-1$
- etc = ""; //$NON-NLS-1$
+ functionName = CommonConstants.EMPTY;
+ offset = CommonConstants.EMPTY;
+ etc = CommonConstants.EMPTY;
makeCallstackData();
}
if (splitPath.length < 2) {
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
- String baseAddr = AnalyzerManager.getProject().getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager.getProject()
+ .getBaseAddress());
String binPath = AnalyzerManager.getProject().getBinaryPath();
functionName = SymbolManager.addr2func(binPath,
}
} else {
if (DACommunicator.isDeviceConnected()
- && path.equals(DACommunicator.getSelectedApp()
- .getInfo(AppInfo.EXEC_INDEX)) && AnalyzerManager.isOsp()) {
+ && path.equals(DACommunicator.getSelectedApp().getInfo(
+ AppInfo.EXEC_INDEX)) && AnalyzerManager.isOsp()) {
path += ".exe"; //$NON-NLS-1$
}
if (functionName.isEmpty()) {
boolean isPieBuild = AnalyzerManager.getProject()
.isPieBuild();
- String baseAddr = AnalyzerManager.getProject()
- .getBaseAddress();
+ String baseAddr = Long.toString(AnalyzerManager
+ .getProject().getBaseAddress());
String binPath = AnalyzerManager.getProject()
.getBinaryPath();
package org.tizen.dynamicanalyzer.ui.info.callstack;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.file.FileChartView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingView;
}
DATableDataFormat tableData = (DATableDataFormat) items[0]
.getData();
- List<String> logData = tableData.getData();
- if (logData.size() <= LogCenterConstants.SEQUENCE_NUMBER_INDEX) {
+ LogData logData = tableData.getLogData();
+ int seqNum = logData.getSeq();
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
+ if (null == cdMap || null == addrMap) {
return;
}
- String seq = logData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- if (null != seq && !seq.isEmpty()) {
- int seqNum = Integer.parseInt(seq);
- HashMap<Integer, CallStackData> cdMap = AnalyzerManager
- .getCallstackManager().getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
- .getCallstackManager().getCallStackApiByAddrMap();
- if (null == cdMap || null == addrMap) {
+ CallStackData csd = cdMap.get(seqNum);
+ if (null == csd) {
+ return;
+ }
+
+ List<Long> addrs = csd.getAddrs();
+ int size = addrs.size();
+ for (int i = 0; i < size; i++) {
+ CallStackUnit api = addrMap.get(addrs.get(i));
+
+ String addr = Formatter.toHexString(addrs.get(i).toString());
+ String path = api.getPath();
+ // if path has "da_probe.so" then reject
+ if (path.contains(AnalyzerConstants.PROBE_LIB_TIZEN)
+ || path.contains(AnalyzerConstants.PROBE_LIB_OSP)) {
return;
}
- CallStackData csd = cdMap.get(seqNum);
- if (null == csd) {
- return;
+ GridItem gridItem = new GridItem(table, SWT.NONE);
+
+ // setData block
+ {
+ long address = addrs.get(i);
+ DATableDataFormat callstackTableData = new DATableDataFormat(
+ address);
+ // 99 means "table type callstack"
+ callstackTableData
+ .setType(LogCenterConstants.TYPE_CALLSTACK);
+ callstackTableData.setObject(address);
+ gridItem.setData(callstackTableData);
}
- List<Long> addrs = csd.getAddrs();
- int size = addrs.size();
- for (int i = 0; i < size; i++) {
- CallStackUnit api = addrMap.get(addrs.get(i));
-
- String addr = Formatter
- .toHexString(addrs.get(i).toString());
- String path = api.getPath();
- // if path has "da_probe.so" then reject
- if (path.contains(AnalyzerConstants.PROBE_LIB_TIZEN)
- || path.contains(AnalyzerConstants.PROBE_LIB_OSP)) {
- return;
- }
- GridItem gridItem = new GridItem(table, SWT.NONE);
-
- // setData block
- {
- String addrStr = Long.toString(addrs.get(i));
- DATableDataFormat callstackTableData = new DATableDataFormat(
- addrStr);
- List<String> data = new ArrayList<String>();
- // 99 means "table type callstack"
- data.add("99"); //$NON-NLS-1$
- callstackTableData.getData().addAll(data);
- callstackTableData.setObject(addrStr);
- gridItem.setData(callstackTableData);
- }
-
- String addrInput = (addrs.get(i) == 0) ? "" : addr; //$NON-NLS-1$
- gridItem.setText(1, addrInput);
-
- String fName = api.getFunctionName();
-
- gridItem.setText(0, fName);
- gridItem.setText(2, path);
- }
+ String addrInput = (addrs.get(i) == 0) ? "" : addr; //$NON-NLS-1$
+ gridItem.setText(1, addrInput);
+
+ String fName = api.getFunctionName();
+
+ gridItem.setText(0, fName);
+ gridItem.setText(2, path);
}
}
package org.tizen.dynamicanalyzer.ui.info.callstack;
-import java.util.List;
-
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
}
if (table.getSelectionCount() > 0) {
GridItem[] selection = table.getSelection();
- List<String> startData = ((DATableDataFormat) selection[0]
- .getData()).getData();
- List<String> endData = ((DATableDataFormat) selection[selection.length - 1]
- .getData()).getData();
- long startTime = Long.parseLong(startData
- .get(LogCenterConstants.TIME_INDEX));
- long endTime = Long.parseLong(endData
- .get(LogCenterConstants.TIME_INDEX));
+ LogData startData = ((DATableDataFormat) selection[0].getData())
+ .getLogData();
+ LogData endData = ((DATableDataFormat) selection[selection.length - 1]
+ .getData()).getLogData();
+ long startTime = startData.getTime();
+ long endTime = endData.getTime();
DASelectionData data = new DASelectionData(observingViews[i],
startTime, endTime, selection, table);
updateView(data);
}
@Override
- public void setSelection(List<String> data) {
+ public void setSelection(LogData data) {
updateView();
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
}
private void computeData() {
- List<String> input = SqlManager.getInstance().getCpuRates(startTime, 1);
- if (null == input || input.size() < 0) {
+ LogData input = SqlManager.getInstance().getCpuRates(startTime, 1);
+ if (null == input) {
input = SqlManager.getInstance().getCpuRates(startTime, 2);
- if (null == input || input.size() < 0) {
+ if (null == input) {
return;
}
}
- if( input.get(0).length() < 1){
- return;
- }
- String[] cpuRates = input.get(0).split(CommonConstants.COMMA);
+ String[] cpuRates = ((SystemData) input).getCpuLoad().split(
+ CommonConstants.COMMA);
cpuUsage.clear();
- for (int i = 0; i < cpuRates.length - 1; i++) {
+ for (int i = 0; i < cpuRates.length; i++) {
String cpu = cpuRates[i].trim();
long value = (long) Float.parseFloat(cpu);
cpuUsage.add(value);
}
- rss = input.get(1);
-
long totalMem = AnalyzerManager.getProject().getSystemMemorySize();
maxMem = totalMem;
- processMem = Long.parseLong(rss);
+ processMem = ((SystemData) input).getResidentMemory();
}
@Override
if (control instanceof DAChartBoard) {
DAChartBoard board = (DAChartBoard) control;
- long time = (long) (((DAChartPlotIntervalMarker) board.getMarkers()
- .get(SELECTION_MARKER_INDEX)).getStartVal() * 1000000);
+ long time = (long) (((DAChartPlotIntervalMarker) board
+ .getMarkers().get(SELECTION_MARKER_INDEX))
+ .getStartVal() * 1000000);
if (time < 0) {
continue;
}
}
if (table.getSelectionCount() > 0) {
GridItem[] selection = table.getSelection();
- List<String> startData = ((DATableDataFormat) selection[0]
- .getData()).getData();
- long time = Long.parseLong(startData
- .get(LogCenterConstants.TIME_INDEX));
+ LogData startData = ((DATableDataFormat) selection[0].getData())
+ .getLogData();
+ long time = startData.getTime();
if (isStartTime) {
setStartTime(time);
} else {
@Override
public void updateLog(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
- if (null == logs || logs.getLogs().size() == 0) {
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM);
+ if (null == logs || null == logs.getLogs() || logs.getLogs().isEmpty()) {
return;
}
- List<List<String>> inputs = logs.getLogs();
+ List<LogData> inputs = logs.getLogs();
int lastIndex = inputs.size() - 1;
- List<String> input = inputs.get(lastIndex);
+ SystemData input = (SystemData) inputs.get(lastIndex);
- String[] cpuRates = input.get(
- LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).split(
- CommonConstants.COMMA);
+ String[] cpuRates = input.getCpuLoad().split(CommonConstants.COMMA);
cpuUsage.clear();
for (int i = 0; i < cpuRates.length - 1; i++) {
String cpu = cpuRates[i].trim();
cpuUsage.add(value);
}
- rss = input.get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX);
long totalMem = AnalyzerManager.getProject().getSystemMemorySize();
maxMem = totalMem;
- processMem = Long.parseLong(rss);
- String time = input.get(LogCenterConstants.TIME_INDEX);
- lastStartTime = Long.parseLong(time);
+ processMem = input.getResidentMemory();
+ lastStartTime = input.getTime();
setStartTime(lastStartTime);
}
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.common.DesignConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public class DAPageComposite extends Composite implements ViewAction {
}
@Override
- public void setSelection(List<String> data) {
+ public void setSelection(LogData data) {
int size = views.size();
for (int i = 0; i < size; i++) {
if (null != views.get(i)) {
package org.tizen.dynamicanalyzer.ui.page;
-import java.util.List;
-
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public interface ViewAction {
public String getViewName();
- public void setSelection(List<String> data);
+ public void setSelection(LogData data);
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
-import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.file.FileDataMaker;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
@Override
public void run() {
- List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
- if (null == logCenters || logCenters.isEmpty()) {
- return;
- }
- List<List<String>> input = null;
+ // List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
+ // if (null == logCenters || logCenters.isEmpty()) {
+ // return;
+ // }
+ List<Integer> logIds = LogDataFactory.getLogList();
+ List<LogData> input = null;
LogPackage logPackage = new LogPackage();
- int size = logCenters.size();
+ int size = logIds.size();
int from = -1;
int last = -1;
for (int i = 0; i < size; i++) {
/* !! sample db table is null.. */
- if (logCenters.get(i).getId() != LogCenterConstants.LOG_DEVICE
- && logCenters.get(i).getId() != LogCenterConstants.LOG_PROFILING) {
+ if (logIds.get(i) != AnalyzerConstants.MSG_DATA_SYSTEM
+ && logIds.get(i) != AnalyzerConstants.MSG_DATA_SAMPLE) {
int ret = SqlManager.getInstance().getRangeMinSeq(
- logCenters.get(i).getName(), markerStartTime);
+ logIds.get(i), markerStartTime);
if (ret >= 0) {
from = (from > 0 && from < ret) ? from : ret;
}
- ret = SqlManager.getInstance().getRangeMaxSeq(
- logCenters.get(i).getName(), markerEndTime);
+ ret = SqlManager.getInstance().getRangeMaxSeq(logIds.get(i),
+ markerEndTime);
if (ret >= 0) {
last = (last > 0 && last > ret) ? last : ret;
}
}
for (int i = 0; i < size; i++) {
- if (logCenters.get(i).getId() != LogCenterConstants.LOG_DEVICE
- && logCenters.get(i).getId() != LogCenterConstants.LOG_PROFILING) {
- Logs logs = new Logs(logCenters.get(i).getId());
- input = SqlManager.getInstance().selectArea(
- logCenters.get(i), from, to);
+ if (logIds.get(i) != AnalyzerConstants.MSG_DATA_SYSTEM
+ && logIds.get(i) != AnalyzerConstants.MSG_DATA_SAMPLE) {
+ Logs logs = new Logs(logIds.get(i));
+ input = SqlManager.getInstance().selectArea(logIds.get(i),
+ from, to);
logs.setLogs(input);
- logPackage.setLogs(logCenters.get(i).getId(), logs);
+ logPackage.setLogs(logIds.get(i), logs);
}
} // for
makeRangeData(logPackage);
from = -1;
last = -1;
for (int i = 0; i < size; i++) {
- if (logCenters.get(i).getId() == LogCenterConstants.LOG_PROFILING) {
+ if (logIds.get(i) == AnalyzerConstants.MSG_DATA_SAMPLE) {
int ret = SqlManager.getInstance().getRangeMinSeq(
- logCenters.get(i).getName(), markerStartTime);
+ logIds.get(i), markerStartTime);
if (ret >= 0) {
from = (from > 0 && from < ret) ? from : ret;
}
- ret = SqlManager.getInstance().getRangeMaxSeq(
- logCenters.get(i).getName(), markerEndTime);
+ ret = SqlManager.getInstance().getRangeMaxSeq(logIds.get(i),
+ markerEndTime);
if (ret >= 0) {
last = (last > 0 && last > ret) ? last : ret;
}
}
for (int i = 0; i < size; i++) {
- if (logCenters.get(i).getId() == LogCenterConstants.LOG_PROFILING) {
- Logs logs = new Logs(logCenters.get(i).getId());
- input = SqlManager.getInstance().selectArea(
- logCenters.get(i), from, to);
+ if (logIds.get(i) == AnalyzerConstants.MSG_DATA_SAMPLE) {
+ Logs logs = new Logs(logIds.get(i));
+ input = SqlManager.getInstance().selectArea(logIds.get(i),
+ from, to);
logs.setLogs(input);
- profilePackage.setLogs(logCenters.get(i).getId(), logs);
+ profilePackage.setLogs(logIds.get(i), logs);
}
} // for
makeRangeData(profilePackage);
}
private void makeRangeData(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_RESOURCE);
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_FILE);
if (null != logs) {
- List<List<String>> resourceInputs = logs.getLogs();
+ List<LogData> resourceInputs = logs.getLogs();
/* make file failed data and warning data */
fileDataMaker.makeData(resourceInputs);
/* resource leak check */
int size = resourceInputs.size();
for (int i = 0; i < size; i++) {
- List<String> input = resourceInputs.get(i);
- String[] inputArray = new String[input.size()];
- input.toArray(inputArray);
- leakDetector.runLeakDectect(inputArray);
+ leakDetector.runLeakDectect(resourceInputs.get(i));
}
}
- logs = logPack.getLogs(LogCenterConstants.LOG_MEMORY);
+ logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_MEMORY);
if (null != logs) {
- List<List<String>> memoryInputs = logs.getLogs();
+ List<LogData> memoryInputs = logs.getLogs();
/* memory leak check */
int size = memoryInputs.size();
for (int i = 0; i < size; i++) {
- List<String> input = memoryInputs.get(i);
- String[] inputArray = new String[input.size()];
- input.toArray(inputArray);
- leakDetector.runLeakDectect(inputArray);
+ leakDetector.runLeakDectect(memoryInputs.get(i));
}
}
- logs = logPack.getLogs(LogCenterConstants.LOG_PROFILING);
+ logs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SAMPLE);
if (null != logs) {
- List<List<String>> profilingInputs = logs.getLogs();
+ List<LogData> profilingInputs = logs.getLogs();
/* profiling data make */
int size = profilingInputs.size();
for (int i = 0; i < size; i++) {
- List<String> input = profilingInputs.get(i);
- String[] inputArray = new String[input.size()];
- input.toArray(inputArray);
+ ProfileData input = (ProfileData) profilingInputs.get(i);
+// String[] inputArray = new String[input.size()];
+// input.toArray(inputArray);
profileDataMaker.makeFunctionUsageProfileData(input);
}
}
logs = logPack.getLogs(LogCenterConstants.LOG_USER_FUNCTION);
if (null != logs) {
- List<List<String>> userFunctions = logs.getLogs();
+ List<LogData> userFunctions = logs.getLogs();
int size = userFunctions.size();
for (int i = 0; i < size; i++) {
- String[] input = new String[userFunctions.get(i).size()];
- userFunctions.get(i).toArray(input);
- String start = input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_START_INDEX];
- String end = input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_END_INDEX];
- if (!start.isEmpty() && !end.isEmpty()
+ UserFunctionData input = (UserFunctionData) userFunctions.get(i);
+ long start = input.getLowPc();
+ long end = input.getHighPc();
+ if (start > 0 && end > 0
&& !AnalyzerManager.isBinStartEndSet()) {
AnalyzerManager.setBinaryStartEndAddr(start, end);
}
package org.tizen.dynamicanalyzer.ui.range;
import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingTable;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
import org.tizen.dynamicanalyzer.listeners.SummaryMouseDoubleClickListener;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangeFailedApiListView;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
GridItem[] items = table.getSelection();
DATableDataFormat dataFormat = (DATableDataFormat) items[0]
.getData();
- String time = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
+ long time = dataFormat.getLogData().getTime();
String id = FailedApiListView.ID;
if (isRange) {
id = RangeFailedApiListView.ID;
}
- DASelectionData selData = new DASelectionData(id, Long
- .parseLong(time), 0, items, table);
+ DASelectionData selData = new DASelectionData(id, time, 0,
+ items, table);
AnalyzerManager.getCurrentPage().updatePage(selData);
AnalyzerManager.getCurrentPage().controlSelection(id);
}
}
protected List<TableInput> makeTableInput() {
- List<FailedData> failedList = null;
+ List<FailedData2> failedList = null;
if (isRange) {
failedList = RangeDataManager.getInstance().getFailedChecker()
.getFailedList();
for (int i = 0; i < size; i++) {
// create text
List<String> text = new ArrayList<String>();
- List<String> failedData = failedList.get(i).getData();
+ FailedData2 failedData = failedList.get(i);
- text.add(failedData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- String time = Formatter.toTimeFormat(failedData
- .get(LogCenterConstants.TIME_INDEX));
+ text.add(Integer.toString(failedData.getSeq()));
+
+ String time = Formatter.toTimeFormat(failedData.getTime());
text.add(time);
- text.add(failedData.get(LogCenterConstants.APINAME_INDEX));
- text.add(failedData.get(LogCenterConstants.INPUTPARM_INDEX));
- text.add(failedData.get(LogCenterConstants.RETURN_INDEX));
- String errCode = ErrorCodeManager.getInatance().getErrorCode(
- failedData.get(LogCenterConstants.ERROR_INDEX));
+ text.add(failedData.getName());
+ text.add(failedData.getArgs());
+ text.add(Long.toString(failedData.getReturn()));
+ String errCode = ErrorCodeManager.getInatance()
+ .getErrorCode(failedData.getErrorCode()).name();
if (null == errCode) {
// FIXME : for debug
errCode = "undefined error number"; //$NON-NLS-1$
text.add(errCode);
String errMsg = ErrorCodeManager.getInatance().getErrorDescription(
- failedData.get(LogCenterConstants.ERROR_INDEX));
+ failedData.getErrorCode());
if (null == errMsg) {
// FIXME : for debug
errMsg = "undefined error number"; //$NON-NLS-1$
// create DATableDataFormat
DATableDataFormat tableData = new DATableDataFormat(
- failedData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- tableData.getData().addAll(failedData);
+ failedData.getSeq());
+ tableData.setObject(failedData);
TableInput tableInput = new TableInput();
tableInput.setText(text);
input.add(tableInput);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- long failedTime = Long.parseLong(failedData
- .get(LogCenterConstants.TIME_INDEX));
- long startTime = RangeDataManager.getInstance().getAnalysisStartTime();
- long endTime = RangeDataManager.getInstance().getAnalysisEndTime();
+ long failedTime = failedData.getTime();
+ long startTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
+ long endTime = RangeDataManager.getInstance()
+ .getAnalysisEndTime();
if (failedTime >= startTime && failedTime <= endTime) {
tableInput.setInRange(true);
}
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.MemoryData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class FailedChecker {
- List<FailedData> failedList;
+ List<FailedData2> failedList;
- public void check(String[] log, CallStackManager cm) {
- String logcId = log[LogCenterConstants.ID_INDEX];
- int cid = Integer.parseInt(logcId);
- if (cid == LogCenterConstants.LOG_MEMORY) {
- if (AnalyzerUtil.isInternal(log)) {
+ public void check(LogData log, CallStackManager cm) {
+ // String logcId = intput[LogCenterConstants.ID_INDEX];
+ // int cid = Integer.parseInt(logcId);
+ if (log instanceof MemoryData) {
+ if (AnalyzerUtil.isInternal((ProbeCommonData) log)) {
return;
}
- String addr = log[LogCenterConstants.MEMORY_ADDR_INDEX];
- if (!addr.equals("0") && !addr.equals("0x0")) { //$NON-NLS-1$ //$NON-NLS-2$
+
+ // String addr = intput[LogCenterConstants.MEMORY_ADDR_INDEX];
+ long addr = ((MemoryData) log).getAddress();
+ // if (!addr.equals("0") && !addr.equals("0x0")) { //$NON-NLS-1$ //$NON-NLS-2$
+ // return;
+ // }
+ if (addr == 0) { //$NON-NLS-1$ //$NON-NLS-2$
return;
}
checkUserDefinedFunc(log, cm);
}
- if (cid == LogCenterConstants.LOG_RESOURCE) {
- if (AnalyzerUtil.isInternal(log)) {
+// if (cid == LogCenterConstants.LOG_RESOURCE) {
+ if (log instanceof FileData) {
+ FileData fileData = ((FileData)log);
+ if (AnalyzerUtil.isInternal(fileData)) {
return;
}
- String fdTypeStr = log[LogCenterConstants.RESOURCE_FDTYPE_INDEX];
- String errnoStr = log[LogCenterConstants.ERROR_INDEX];
- int fdType = Integer.parseInt(fdTypeStr);
- long errno = Long.parseLong(errnoStr);
+// String fdTypeStr = intput[LogCenterConstants.RESOURCE_FDTYPE_INDEX];
+// String errnoStr = intput[LogCenterConstants.ERROR_INDEX];
+// int fdType = Integer.parseInt(fdTypeStr);
+// long errno = Long.parseLong(errnoStr);
+ int fdType = fileData.getFDType();
+ long errno = fileData.getErrno();
// file or (not error) - file error check file page
if (fdType == 0 || errno == 0) {
return;
}
- checkUserDefinedFunc(log, cm);
+ checkUserDefinedFunc(fileData, cm);
}
- if (cid == LogCenterConstants.LOG_USER_FUNCTION) {
+// if (cid == LogCenterConstants.LOG_USER_FUNCTION) {
+ if (log instanceof UserFunctionData) {
// TODO : check user function error???
return;
}
}
- private void checkUserDefinedFunc(String[] input, CallStackManager cm) {
- if (AnalyzerConstants.USER_CALL == AnalyzerUtil.checkUserCall(input)) {
- FailedData fd = new FailedData(input);
+ private void checkUserDefinedFunc(LogData log, CallStackManager cm) {
+// if (AnalyzerConstants.USER_CALL == AnalyzerUtil.checkUserCall((ProbeCommonData)log)) {
+ FailedData2 fd = new FailedData2(log);
getFailedList().add(fd);
- }
+// }
}
- public List<FailedData> getFailedList() {
+ public List<FailedData2> getFailedList() {
if (null == failedList) {
- failedList = new ArrayList<FailedData>();
+ failedList = new ArrayList<FailedData2>();
}
return failedList;
}
return data;
}
- public String getLogData(int logIndex) {
+ public String getData(int logIndex) {
if (!getData().isEmpty()) {
return data.get(logIndex);
}
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.Check;
import org.tizen.dynamicanalyzer.model.LeakCheckList;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LeakData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
public final static int API_TYPE_REALLOC = 2;
HashMap<String, Check> leakCheckHash;
- HashMap<String, LeakData> leakHash;
- HashMap<String, LeakData> childHash;
+ HashMap<Integer, LeakData2> leakHash;
+ HashMap<Integer, LeakData2> childHash;
private int leakSeq = 0;
public LeakDetector() {
}
}
- public List<LeakData> getLeakDataList() {
- List<LeakData> leakList = new ArrayList<LeakData>();
+ public List<LeakData2> getLeakDataList() {
+ List<LeakData2> leakList = new ArrayList<LeakData2>();
leakList.addAll(getLeakHash().values());
return leakList;
}
- public HashMap<String, LeakData> getLeakHash() {
+ public HashMap<Integer, LeakData2> getLeakHash() {
if (null == leakHash) {
- leakHash = new HashMap<String, LeakData>();
+ leakHash = new HashMap<Integer, LeakData2>();
}
return leakHash;
}
- public HashMap<String, LeakData> getChildHash() {
+ public HashMap<Integer, LeakData2> getChildHash() {
if (null == childHash) {
- childHash = new HashMap<String, LeakData>();
+ childHash = new HashMap<Integer, LeakData2>();
}
return childHash;
}
public HashMap<String, Check> getLeakCheckHash() {
if (null == leakCheckHash) {
- LeakCheckList leakCheckList = AnalyzerManager.getLeakCheckList();
leakCheckHash = new HashMap<String, Check>();
- List<Check> checks = leakCheckList.getChecks();
- int size = checks.size();
- for (int i = 0; i < size; i++) {
- leakCheckHash.put(checks.get(i).getName(), checks.get(i));
+ LeakCheckList leakCheckList = AnalyzerManager.getLeakCheckList();
+ if (null != leakCheckList) {
+ List<Check> checks = leakCheckList.getChecks();
+ if (null != checks) {
+ int size = checks.size();
+ for (int i = 0; i < size; i++) {
+ leakCheckHash.put(checks.get(i).getName(),
+ checks.get(i));
+ }
+ }
}
}
return leakCheckHash;
}
- public void runLeakDectect(String[] input) {
- if (null == input || 0 == input.length) {
- return;
- }
-
- String apiName = input[LogCenterConstants.APINAME_INDEX];
- String errorStr = input[LogCenterConstants.ERROR_INDEX];
- long errno = Long.parseLong(errorStr);
+ public void runLeakDectect(LogData logData) {
+ ProbeCommonData log = (ProbeCommonData) logData;
+ String apiName = log.getApiName();
+ long errno = log.getErrno();
if (0 != errno) {
return;
}
+
// step 1 : check "open" or "close"
Check chk; // 0: open , 1: close
if (null == getLeakCheckHash().get(apiName)) {
chk = getLeakCheckHash().get(apiName);
}
- HashMap<String, LeakData> leaks = getLeakHash();
+ HashMap<Integer, LeakData2> leaks = getLeakHash();
if (chk.getType() == API_TYPE_OPEN) {
if (chk.isCheckUserCall()) {
- checkUserFuncLeakData(input, chk);
+ checkUserFuncLeakData(logData, chk);
} else {
- LeakData newLeak = new LeakData(input[chk.getKeyIndex()],
- input, this);
- leaks.put(newLeak.getKey(), newLeak);
+ LeakData2 newLeak = new LeakData2(logData, this);
+ leaks.put(logData.getKey(), newLeak);
}
} else if (chk.getType() == API_TYPE_CLOSE) {
- String key = null;
- try {
- key = input[chk.getKeyIndex()];
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- return;
- }
- if (null == key) {
- System.out.println(input);
- return;
- }
- LeakData freeData = getChildHash().get(key);
+ int key = log.getKey();
+ LeakData2 freeData = getChildHash().get(key);
if (null != freeData) {
- LeakData parent = leaks.get(freeData.getParentKey());
+ LeakData2 parent = leaks.get(freeData.getParentKey());
parent.removeChild(key);
getChildHash().remove(key);
if (parent.getChildren().isEmpty()) {
// System.out.println("realloc!! " + input);
// free index = input param 1st
- String inputParam = input[LogCenterConstants.INPUTPARM_INDEX];
+// String inputParam = input[LogCenterConstants.INPUTPARM_INDEX];
+ String inputParam = ((ProbeCommonData)log).getArgs();
String[] splitInputParam = inputParam.split("\\,"); //$NON-NLS-1$
- String rmKey = splitInputParam[0];
+ int rmKey = Integer.parseInt(splitInputParam[0]);
leaks.remove(rmKey);
// internal check
if (chk.isCheckUserCall()) {
- checkUserFuncLeakData(input, chk);
+ checkUserFuncLeakData(log, chk);
} else {
- String key = input[chk.getKeyIndex()];
- leaks.put(key, new LeakData(key, input, this));
+// String key = input[chk.getKeyIndex()];
+// leaks.put(key, new LeakData(key, input, this));
+ int key = log.getKey();
+ leaks.put(key, new LeakData2(log, this));
}
}
}
- private void checkUserFuncLeakData(String[] input, Check chk) {
- HashMap<Integer, CallStackData> cdMap = AnalyzerManager.getCallstackManager()
- .getCallStackDataBySeqMap();
+ private void checkUserFuncLeakData(LogData log, Check chk) {
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
// HashMap<Long, String> apiMap = LogSpliter.getCallStackApiByAddrMap();
- HashMap<Long, CallStackUnit> addrMap = AnalyzerManager.getCallstackManager()
- .getCallStackApiByAddrMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
return;
}
- int seqNum = Integer
- .parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
+ int seqNum = log.getSeq();
CallStackData csd = cdMap.get(seqNum);
if (null == csd) {
-// System.out.println("no callstack "); //$NON-NLS-1$
-// for (int i = 0; i < input.length; i++)
-// {
-// System.out.print(input[i] + " "); //$NON-NLS-1$
-// }
-// System.out.println();
+ // System.out.println("no callstack "); //$NON-NLS-1$
+ // for (int i = 0; i < input.length; i++)
+ // {
+ // System.out.print(input[i] + " "); //$NON-NLS-1$
+ // }
+ // System.out.println();
return;
}
List<Long> addrs = null;
// user call
if (AnalyzerManager.getCallstackManager().isUserCall(
callerFunc.getFunctionName())) {
- HashMap<String, LeakData> leaks = getLeakHash();
- LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input,
- this);
+ HashMap<Integer, LeakData2> leaks = getLeakHash();
+ LeakData2 newLeak = new LeakData2(log, this);
leaks.put(newLeak.getKey(), newLeak);
}
// for internal leak
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.listeners.SummaryMouseDoubleClickListener;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TreeInput;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LeakData2;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangeLeakView;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
DATableDataFormat dataFormat = (DATableDataFormat) items[0]
.getData();
- String time = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
+ long time = dataFormat.getLogData().getTime();
String id = LeakView.ID;
if (isRange) {
id = RangeLeakView.ID;
}
- DASelectionData selData = new DASelectionData(id, Long
- .parseLong(time), 0, items, table);
+ DASelectionData selData = new DASelectionData(id, time, 0,
+ items, table);
AnalyzerManager.getCurrentPage().updatePage(selData);
AnalyzerManager.getCurrentPage().controlSelection(id);
}
}
// !! recursive!!
- public void makeChildTree(List<LeakData> children, TreeInput parent,
+ public void makeChildTree(List<LeakData2> children, TreeInput parent,
String parentName) {
if (!children.isEmpty()) {
int size = children.size();
for (int i = 0; i < size; i++) {
- LeakData data = children.get(i);
+ LeakData2 data = children.get(i);
TreeInput input = makeInput(data);
parent.getChildren().add(input);
input.setParent(parentName);
@Override
public List<TreeInput> makeTreeInput() {
List<TreeInput> output = new ArrayList<TreeInput>();
- HashMap<String, LeakData> leaks = null;
+ HashMap<Integer, LeakData2> leaks = null;
if (isRange) {
leaks = RangeDataManager.getInstance().getLeakDetector()
.getLeakHash();
} else {
leaks = AnalyzerManager.getLeakDetector().getLeakHash();
}
- ArrayList<LeakData> leakList = new ArrayList<LeakData>();
+ ArrayList<LeakData2> leakList = new ArrayList<LeakData2>();
leakList.addAll(leaks.values());
int size = leakList.size();
for (int i = 0; i < size; i++) {
- LeakData leakData = leakList.get(i);
+ LeakData2 leakData = leakList.get(i);
TreeInput leakInput = makeInput(leakData);
makeChildTree(leakData.getChildren(), leakInput,
- leakData.getParentKey());
+ Integer.toString(leakData.getParentKey()));
output.add(leakInput);
}
return output;
}
- private TreeInput makeInput(LeakData leakData) {
- List<String> data = leakData.getData();
+ private TreeInput makeInput(LeakData2 leakData) {
DATableDataFormat tableData = new DATableDataFormat(
- data.get(LeakData.LEAK_SEQ_INDEX));
- tableData.getData().addAll(data);
+ leakData.getLeakSeq());
+ tableData.setObject(leakData);
List<String> text = new ArrayList<String>();
text.add(leakData.getName()); // 0 column empty value for tree
- text.add(leakData.getSeq()); // 1
+ text.add(Integer.toString(leakData.getSeq())); // 1
- int type = Integer.parseInt(leakData.getId());
- if (type == LogCenterConstants.LOG_MEMORY) {
+ int type = leakData.getId();
+ if (type == AnalyzerConstants.MSG_PROBE_MEMORY) {
text.add(SummaryLabels.LEAK_TABLE_MEMORY);
- } else if (type == LogCenterConstants.LOG_RESOURCE) {
- text.add(SummaryLabels.LEAK_TABLE_RESOURCE);
+ } else if (type == AnalyzerConstants.MSG_PROBE_FILE) {
+ text.add(SummaryLabels.LEAK_TABLE_FILE);
} else {
text.add(SummaryLabels.LEAK_TABLE_ETC);
} // 2
- String time = leakData.getTime();
+ long time = leakData.getTime();
try {
text.add(Formatter.toTimeFormat(time));
} catch (NumberFormatException e) {
e.printStackTrace();
- text.add(time);
+ text.add(Long.toString(time));
} // 3
tableData.setObject(leakData.getName()); // 4
text.add(leakData.getParam()); // 5
- text.add(leakData.getRet()); // 6
+ text.add(Long.toString(leakData.getRet())); // 6
TreeInput output = new TreeInput();
output.setText(text);
output.setData(tableData);
- output.setParent(leakData.getParentKey());
+ output.setParent(Integer.toString(leakData.getParentKey()));
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- long leakTime = Long.parseLong(time);
- long startTime = RangeDataManager.getInstance().getAnalysisStartTime();
+ long leakTime = time;
+ long startTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
long endTime = RangeDataManager.getInstance().getAnalysisEndTime();
if (leakTime >= startTime && leakTime <= endTime) {
output.setInRange(true);
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
public class FunctionUsageProfiler implements Runnable {
* key: symbol(child) or file path (parent) - value : sequence num of
* profiling data. all parent and child data is in
*/
- private List<List<List<String>>> sampleInputs = null;
+ private List<List<LogData>> sampleInputs = null;
private static Thread profiler = null;
public FunctionUsageProfiler() {
return instance;
}
- private List<List<List<String>>> getSampleInputs() {
+ private List<List<LogData>> getSampleInputs() {
if (null == sampleInputs) {
- sampleInputs = new ArrayList<List<List<String>>>();
+ sampleInputs = new ArrayList<List<LogData>>();
}
return sampleInputs;
}
- private synchronized List<List<String>> getFirstSample() {
+ private synchronized List<LogData> getFirstSample() {
while (isSampleInputEmpty()) {
if (LogParser.isLogParsingComplete()) {
return null;
continue;
}
}
- List<List<String>> first = getSampleInputs().get(0);
+ List<LogData> first = getSampleInputs().get(0);
getSampleInputs().remove(0);
notifyAll();
return first;
return false;
}
- public synchronized void pushSample(List<List<String>> sample) {
+ public synchronized void pushSample(List<LogData> sample) {
while (isSampleInputFull()) {
try {
wait();
public void run() {
System.out.println("start profiling thread"); //$NON-NLS-1$
while (!AnalyzerManager.isExit()) {
- List<List<String>> sample = getInstance().getFirstSample();
+ List<LogData> sample = getInstance().getFirstSample();
if (null == sample) {
break;
}
int size = sample.size();
for (int i = 0; i < size; i++) {
getInstance().getProfileDataMaker()
- .makeFunctionUsageProfileData(sample.get(i));
+ .makeFunctionUsageProfileData((ProfileData) sample.get(i));
}
}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.model.ColumnData;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
@Override
public void updateLog(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_PROFILING);
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SAMPLE);
if (null == logs || logs.getLogs().size() == 0) {
return;
}
- List<List<String>> inputs = logs.getCloneLogs();
+ List<LogData> inputs = logs.getCloneLogs();
FunctionUsageProfiler.getInstance().pushSample(inputs);
}
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.utils.Formatter;
* key: seq - value : function usage profiling data hash map all function
* usage profiling data are in this hash map
**/
- private HashMap<String, ProfilingData> profilingDataMap = null;
+ private HashMap<Integer, ProfilingData> profilingDataMap = null;
private HashMap<String, String> symbolSeqHash = null;
/**
}
public ProfilingData getProfilingDataByKey(String key) {
- String seq = getSymbolSeqHash().get(key);
- if (null == seq) {
- return null;
+ HashMap<String, String> hash = getSymbolSeqHash();
+ String seq = hash.get(key);
+ if (null != seq) {
+ return getProfilingDataMap().get(Integer.parseInt(seq));
}
-
- return getProfilingDataMap().get(seq);
+ return null;
}
- public HashMap<String, ProfilingData> getProfilingDataMap() {
+ public HashMap<Integer, ProfilingData> getProfilingDataMap() {
if (null == profilingDataMap) {
- profilingDataMap = new HashMap<String, ProfilingData>();
+ profilingDataMap = new HashMap<Integer, ProfilingData>();
}
return profilingDataMap;
}
}
}
- public void makeFunctionUsageProfileData(List<String> sampleLog) {
+ public void makeFunctionUsageProfileData(ProfileData sampleLog) {
totalSampleCount++;
- String callstack = sampleLog
- .get(LogCenterConstants.PROFILING_LOG_CALLSTACK_INDEX);
+ String callstack = sampleLog.getCallstack();
String[] splitCallstack = callstack
.split(AnalyzerConstants.DATA_PARSING_TOKEN);
List<Long> addrs = makeCallstackHashAndList(sampleCallstack);
HashMap<Long, CallStackUnit> addrMap = callstackManager
.getCallStackApiByAddrMap();
- String selfAddrStr = sampleLog
- .get(LogCenterConstants.PROFILING_LOG_PCADDR_INDEX);
- long selfAddr = Long.parseLong(selfAddrStr);
+ long selfAddr = sampleLog.getPcAddress();
CallStackUnit inputData = addrMap.get(selfAddr);
if (null == inputData) {
return;
}
// inclusive cpu time
- for (int i = 0; i < addrs.size(); i++) {
+ int size = 0;
+ if (null != addrs) {
+ size = addrs.size();
+ }
+ for (int i = 0; i < size; i++) {
CallStackUnit callstackCsa = addrMap.get(addrs.get(i));
// disable inclusive cpu time of dependent library
if (!callstackManager.checkUserCall(callstackCsa.getPath())) {
if (null != inParent.getParent()) {
String pInParentName = inParent.getParent();
pp = getProfilingDataByKey(pInParentName);
- pp.addInCount(totalSampleCount);
+ if (null != pp) {
+ pp.addInCount(totalSampleCount);
+ }
}
} else {
ProfilingData fupData = getProfilingDataByKey(callstackCsa
newProfilingData);
if (isParent) {
getSymbolSeqHash().put(inputData.getPath(),
- newProfilingData.getSequence());
+ Integer.toString(newProfilingData.getSequence()));
} else {
getSymbolSeqHash().put(inputData.getSymbol(),
- newProfilingData.getSequence());
+ Integer.toString(newProfilingData.getSequence()));
}
return newProfilingData;
}
public void makeFupDataForCallTrace(CallStackUnit inputCallstackApiData,
- String[] inputLog) {
+ UserFunctionData log) {
+ totalSampleCount++;
long exeTime = 0;
- String strType = inputLog[LogCenterConstants.USER_FUNCTION_TYPE_INDEX];
- int type = Integer.parseInt(strType);
+ int type = log.getType();
if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- String strExeTime = inputLog[LogCenterConstants.USER_FUNCTION_ELAPSED_TIME_INDEX];
- exeTime += Long.parseLong(strExeTime);
+ exeTime += log.getElapsedTime();
}
ProfilingData parent = getProfilingDataByKey(inputCallstackApiData
parent.addChild(child);
child.setParent(parent.getName());
}
+ child.addExCount();
child.addElpasedTime(exeTime);
if (type != LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
child.addCallCount();
public class ProfilingChildData {
private String seq;
- private List<String> children;
+ private List<Integer> children;
public ProfilingChildData(String seq) {
this.seq = seq;
return seq;
}
- public List<String> getChildren() {
+ public List<Integer> getChildren() {
if (null == children) {
- children = new ArrayList<String>();
+ children = new ArrayList<Integer>();
}
return children;
}
}
public void addChild(ProfilingData child) {
- String seq = child.getSequence();
+ int seq = child.getSequence();
getChildData().getChildren().add(seq);
}
}
public int getExCount() {
- List<String> seqs = getChildData().getChildren();
+ List<Integer> seqs = getChildData().getChildren();
if (seqs.isEmpty()) {
return exCount;
}
return true;
}
- public String getSequence() {
- return Integer.toString(seq);
+ public int getSequence() {
+ return seq;
}
// use only opentrace
public List<ProfilingData> getChildList() {
List<ProfilingData> output = new ArrayList<ProfilingData>();
- List<String> seqs = getChildData().getChildren();
+ List<Integer> seqs = getChildData().getChildren();
for (int i = 0; i < seqs.size(); i++) {
ProfilingData child = profiler.getProfilingDataMap().get(
for (int i = 0; i < ProfilingData.DATA_FIELD_SIZE; i++) {
inputData.add(CommonConstants.EMPTY);
}
- inputData.set(ProfilingData.SEQUENCE_INDEX, input.getSequence());
+ inputData.set(ProfilingData.SEQUENCE_INDEX,
+ Integer.toString(input.getSequence()));
inputData.set(ProfilingData.NAME_INDEX, input.getName());
inputData.set(ProfilingData.EXCOUNT_INDEX,
Integer.toString(input.getExCount()));
if (0 == input.getExclusiveElapsedTime()) {
exeTime = CommonConstants.DASH;
} else {
- exeTime = Long.toString(input.getExclusiveElapsedTime());
- exeTime = Formatter.toTimeFormat(exeTime);
+ exeTime = Formatter.toTimeFormat(input
+ .getExclusiveElapsedTime());
}
if (0 == input.getElapsedTime()) {
inExeTime = CommonConstants.DASH;
} else {
- inExeTime = Long.toString(input.getElapsedTime());
- inExeTime = Formatter.toTimeFormat(inExeTime);
+ inExeTime = Formatter.toTimeFormat(input.getElapsedTime());
}
} catch (NumberFormatException e) {
// FIXME
import java.util.List;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
public class WarningChecker {
private List<WarningData> warningData = null;
return warningData;
}
- public WarningData getWarningDataByLogSeq(String seq) {
+ public WarningData getWarningDataByLogSeq(int seq) {
int size = getWarningData().size();
for (int i = 0; i < size; i++) {
WarningData data = getWarningData().get(i);
- String logSeq = data.getData().get(
- LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- if (null != logSeq && seq.equals(logSeq)) {
+ int wSeq = data.getSeq();
+ if (wSeq == seq) {
return data;
}
}
}
return false;
}
-
+
public boolean removeData(String key, int type) {
int size = getWarningData().size();
for (int i = 0; i < size; i++) {
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
+
public class WarningData {
private static int uNum = 1;
private int seq = 0;
private int warningCase;
private List<String> data = null;
private String key = null;
+ private long callerPc = -1;
- public WarningData(int logId, int wCase, List<String> data, String key) {
+ public WarningData(int wCase, LogData data, String key) {
seq = uNum++;
- category = logId;
+ category = data.getId();
warningCase = wCase;
- this.data = data;
this.key = key;
+ callerPc = ((ProbeCommonData) data).getCallerPcAddr();
}
public List<String> getData() {
public static void resetSeq() {
uNum = 1;
}
+
+ public long getCallerPc() {
+ return callerPc;
+ }
}
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
}
GridItem item = items[0];
DATableDataFormat tableData = (DATableDataFormat) item.getData();
- String seq = tableData.getData().get(
- LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ int seq = tableData.getLogData().getSeq();
WarningChecker warningChecker = null;
if (isRange) {
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.listeners.SummaryMouseDoubleClickListener;
DATableDataFormat dataFormat = (DATableDataFormat) items[0]
.getData();
- String time = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
+ long time = dataFormat.getLogData().getTime();
String id = WarningListView.ID;
if (isRange) {
id = RangeWarningListView.ID;
}
- DASelectionData selData = new DASelectionData(id, Long
- .parseLong(time), 0, items, table);
+ DASelectionData selData = new DASelectionData(id, time, 0,
+ items, table);
AnalyzerManager.getCurrentPage().updatePage(selData);
AnalyzerManager.getCurrentPage().controlSelection(id);
}
text.add(warningInput.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
{
- if (LogCenterConstants.LOG_RESOURCE == warningData
+ if (AnalyzerConstants.MSG_PROBE_FILE == warningData
.getCategory()) {
String fdType = warningInput
.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
// create DATableDataFormat
DATableDataFormat tableData = new DATableDataFormat(
- warningInput.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+ warningData.getSeq());
tableData.getData().addAll(warningData.getData());
-
TableInput tableInput = new TableInput();
tableInput.setText(text);
tableInput.setData(tableData);
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class ThreadAPIListTable extends DAApiListTableComposite {
private DAChartBoard chartBoard = null;
-
+
public ThreadAPIListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
table.addSelectionListener(new SelectionListener() {
long endTime = 0;
DATableDataFormat dataFormat;
- String time;
for (int i = 0; i < items.length; i++) {
dataFormat = (DATableDataFormat) items[i].getData();
- time = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
- long itemTime = Long.parseLong(time);
+ long itemTime = dataFormat.getLogData().getTime();
if (0 == startTime) {
startTime = itemTime;
}
ThreadAPIListView view = (ThreadAPIListView) AnalyzerManager
.getCurrentPage().getViewMap().get(ThreadAPIListView.ID);
- if (!(view instanceof ThreadAPIListView)) {
- return null;
- }
ThreadPageData data = view.getPageData();
long rangeStartTime = view.getAnalysisStartTime();
long rangeEndTime = view.getAnaysisEndTime();
ThreadPageDataEvent content;
for (int i = 0; i < contents.size(); i++) {
content = contents.get(i);
- List<String> contentTemp = content.getContents();
+ ThreadData contentTemp = (ThreadData) content.getContents();
List<String> contentText = new ArrayList<String>();
- String seq = contentTemp
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ String seq = Integer.toString(contentTemp.getSeq());
contentText.add(0, seq);
- contentText.add(Formatter.toTimeFormat(contentTemp
- .get(LogCenterConstants.TIME_INDEX)));
- contentText.add(contentTemp.get(LogCenterConstants.APINAME_INDEX));
- contentText
- .add(contentTemp.get(LogCenterConstants.INPUTPARM_INDEX));
- contentText
- .add(contentTemp.get(LogCenterConstants.THREAD_ID_INDEX));
- contentText.add(contentTemp.get(LogCenterConstants.RETURN_INDEX));
- String errMsg = ErrorCodeManager.getInatance().getErrorCode(
- contentTemp.get(LogCenterConstants.ERROR_INDEX));
+ contentText.add(Formatter.toTimeFormat(contentTemp.getTime()));
+ contentText.add(contentTemp.getApiName());
+ contentText.add(contentTemp.getArgs());
+ contentText.add(Long.toString(contentTemp.getPThreadId()));
+ contentText.add(Long.toString(contentTemp.getReturn()));
+ String errMsg = ErrorCodeManager.getInatance()
+ .getErrorCode(contentTemp.getErrno()).name();
if (null == errMsg) {
errMsg = "undefined error code";
}
contentText.add(errMsg);
DATableDataFormat tableData = new DATableDataFormat(
- contentTemp.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- tableData.getData().addAll(contentTemp);
+ contentTemp.getSeq());
+ tableData.setLogData(contentTemp);
TableInput tableInput = new TableInput();
tableInput.setText(contentText);
tableInput.setData(tableData);
input.add(tableInput);
- long time = Long.parseLong(contentTemp
- .get(LogCenterConstants.TIME_INDEX));
+ long time = contentTemp.getTime();
if (time >= rangeStartTime && time <= rangeEndTime) {
tableInput.setInRange(true);
}
private DAChartBoard getChartBoard() {
if (chartBoard == null) {
- return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
- FileChartView.ID).getControl());
+ chartBoard = (DAChartBoard) (AnalyzerManager.getCurrentPage()
+ .getView(ThreadChartView.ID).getControl());
}
return chartBoard;
}
protected void actionSetStartEnd(int type) {
GridItem item = table.getItem(mousePoint);
if (null != item) {
- List<String> data = ((DATableDataFormat) item.getData()).getData();
- String time = data.get(LogCenterConstants.TIME_INDEX);
- long inputTime = -1;
- try {
- inputTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
+ LogData data = ((DATableDataFormat) item.getData()).getLogData();
+ long inputTime = data.getTime();
+ double startTime = -1;
+ double endTime = -1;
+ DAChartBoard board = getChartBoard();
+
if (type == START_TIME) {
rangeDataManager.setMarkerStartTime(inputTime);
- getChartBoard().setTimelineMarkerStartTime(
- inputTime / TimelineConstants.MEGA);
+ startTime = inputTime / TimelineConstants.MEGA;
+ endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
} else if (type == END_TIME) {
rangeDataManager.setMarkerEndTime(inputTime);
- getChartBoard().setTimelineMarkerEndTime(
- inputTime / TimelineConstants.MEGA);
+ endTime = inputTime / TimelineConstants.MEGA;
+ startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
}
+
+ board.setTimelineMarkerStartTime(startTime);
+ board.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
}
}
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogListQueue;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncDataManager;
import org.tizen.dynamicanalyzer.ui.thread.thread.ThreadPageThreadDataManager;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
}
}
- public List<List<String>> getLogsFromLogPackage(LogPackage logPack,
+ public List<LogData> getLogsFromLogPackage(LogPackage logPack,
int logCenterConstants) {
Logs logs = logPack.getLogs(logCenterConstants);
if (null == logs || logs.getLogs().size() == 0) {
return null;
}
- List<List<String>> ret = logs.getCloneLogs();
+ List<LogData> ret = logs.getCloneLogs();
return ret;
}
public void updateLog(LogPackage logPack) {
- List<List<String>> loadInputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_DEVICE);
+ List<LogData> loadInputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_DATA_SYSTEM);
if (null != loadInputs) {
logListQueue.putLog(loadInputs);
}
- List<List<String>> threadInputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_THREAD);
+ List<LogData> threadInputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_PROBE_THREAD);
if (null != threadInputs) {
logListQueue.putLog(threadInputs);
}
- List<List<String>> syncInputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_SYNC);
+ List<LogData> syncInputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_PROBE_SYNC);
if (null != syncInputs) {
logListQueue.putLog(syncInputs);
@Override
public void run() {
while (!AnalyzerManager.isExit()) {
- List<List<String>> logs = logListQueue.getFirst();
+ List<LogData> logs = logListQueue.getFirst();
if (null == logs) {
break;
}
int logSize = logs.size();
- List<String> log;
+ LogData log;
int logType;
for (int i = 0; i < logSize; i++) {
log = logs.get(i);
- logType = Integer.valueOf(log.get(0));
- if (logType == LogCenterConstants.LOG_DEVICE) {
+ logType = log.getId();
+ if (logType == AnalyzerConstants.MSG_DATA_SYSTEM) {
tManager.parseLoad(log);
- } else if (logType == LogCenterConstants.LOG_THREAD) {
+ } else if (logType == AnalyzerConstants.MSG_PROBE_THREAD) {
tManager.parseAPI(log);
- } else if (logType == LogCenterConstants.LOG_SYNC) {
+ } else if (logType == AnalyzerConstants.MSG_PROBE_SYNC) {
tManager.parseSync(log);
sManager.parseSync(log);
}
*/
package org.tizen.dynamicanalyzer.ui.thread;
-import java.util.List;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
threadChart.setVisibleStart(syncChart.getVisibleStart());
threadChart.setZoomout(syncChart.isZoomout());
callUpdatePage(threadChart.getSelectItem());
+ updateView();
}
private void changeComboThreadToSync() {
syncChart.setVisibleStart(threadChart.getVisibleStart());
syncChart.setZoomout(threadChart.isZoomout());
callUpdatePage(syncChart.getSelectItem());
+ updateView();
}
private void setTimelineMouseListener(final DATimeline timeline,
double startTime = (double) start / TimelineConstants.MEGA;
double endTime = (double) end / TimelineConstants.MEGA;
double middleTime = (startTime + endTime) / 2.0;
- if (endTime == startTime) {
+ if (start == end) {
middleTime = startTime;
}
}
@Override
- public void setSelection(List<String> data) {
+ public void setSelection(LogData data) {
if (stackLayout.topControl.equals(syncChart)) {
changeComboSyncToThread();
}
- String selectTid = data.get(LogCenterConstants.THREAD_ID_INDEX);
+ String selectTid = Long.toString(((ThreadData) data).getPThreadId());
threadChart.selectItem(manager.getItemIndexByTid(selectTid));
}
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
ThreadPageDataEvent event, long errno) {
DAChartSeriesItem apiItem = null;
if (0 != errno) {
- FailedData ffd = new FailedData(event.getContents());
+ FailedData2 ffd = new FailedData2(event.getContents());
AnalyzerManager.getFailedChecker().getFailedList().add(ffd);
apiItem = new DAChartSeriesItem(event.getTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
*/
package org.tizen.dynamicanalyzer.ui.thread;
-import java.util.ArrayList;
-import java.util.List;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public abstract class ThreadPageDataEvent {
- private List<String> contents;
+ private LogData contents;
private double time = -1;
private String tid = null;
private int apiType = -1;
private long errorNum = -1;
public ThreadPageDataEvent(double time, String tid, int apiType,
- String tooltip, long errorNum, List<String> contents) {
+ String tooltip, long errorNum, LogData contents) {
setTime(time);
setTid(tid);
setApiType(apiType);
setContents(contents);
}
- public List<String> getContents() {
- if (null == contents) {
- contents = new ArrayList<String>();
- }
+ public LogData getContents() {
return contents;
}
- public void setContents(List<String> contents) {
+ public void setContents(LogData contents) {
this.contents = contents;
}
protected int createChartItem(ThreadPageDataEvent event) {
DAChartSeriesItem stateItem = null;
DAChartSeriesItem apiItem = null;
- ThreadPageSyncDataEvent syncEvent = (ThreadPageSyncDataEvent) event;
- if (!(syncEvent instanceof ThreadPageSyncDataEvent)) {
+ if (!(event instanceof ThreadPageSyncDataEvent)) {
System.out.println("error : createChartItem");
return -1;
}
+ ThreadPageSyncDataEvent syncEvent = (ThreadPageSyncDataEvent) event;
+
int apiType = syncEvent.getApiType();
long errorNum = syncEvent.getErrorNum();
switch (apiType) {
*/
package org.tizen.dynamicanalyzer.ui.thread.sync;
-import java.util.List;
-
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageDataEvent;
public class ThreadPageSyncDataEvent extends ThreadPageDataEvent {
public ThreadPageSyncDataEvent(String syncVal, int type, int apiType,
double time, String tid, String tooltip, long errorNum,
- List<String> contents) {
+ LogData contents) {
super(time, tid, apiType, tooltip, errorNum, contents);
setSyncVal(syncVal);
setType(type);
import java.util.HashMap;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SyncData;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
return CommonConstants.EMPTY;
}
- public void parseSync(List<String> input) {
+ public void parseSync(LogData input) {
- if (null == input) {
+ if (null == input || !(input instanceof SyncData)) {
return;
}
-
- if (Integer.valueOf(input.get(0)) != LogCenterConstants.LOG_SYNC) {
- return;
- }
-
+ SyncData syncData = (SyncData) input;
// System.out.println("input : " + input);
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX)) / TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
+ double time = Double.parseDouble(Long.toString(syncData.getTime()))
+ / TimelineConstants.MEGA;
+ String tid = Integer.toString(syncData.getTid());
- int type = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_TYPE_INDEX));
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
+ int type = syncData.getSyncType();
+ int apiType = syncData.getApiType();
+ String apiName = syncData.getApiName();
- String name = input.get(LogCenterConstants.SYNC_VAL_INDEX);
+ String name = Long.toString(syncData.getSyncValue());
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
+ long errorNum = syncData.getErrno();
ThreadPageSyncDataEvent event;
switch (type) {
case LogCenterConstants.SYNC_TYPE_PTHREAD_COND_VARIABLE:
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_INIT)) {
- syncAttrMap.put(input.get(LogCenterConstants.INPUTPARM_INDEX),
- -1);
+ syncAttrMap.put(syncData.getArgs(), -1);
} else if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_SETTYPE)) {
- checkMutexAttrType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexAttrType(syncData.getArgs());
} else {
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEX_INIT)) {
- checkMutexType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexType(syncData.getArgs());
}
event = new ThreadPageSyncDataEvent(name, type, apiType, time,
tid, apiName, errorNum, input);
}
}
- private void parseSyncs(List<List<String>> inputs) {
- int size;
- if (null == inputs || 0 == (size = inputs.size())) {
+ private void parseSyncs(List<LogData> inputs) {
+ if (null == inputs || inputs.isEmpty()) {
return;
}
- List<String> input;
+ int size = inputs.size();
+ SyncData input;
for (int i = 0; i < size; i++) {
- input = inputs.get(i);
+ input = (SyncData) inputs.get(i);
// System.out.println("input : " + input);
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX))
+ double time = Double.parseDouble(Long.toString(input.getTime()))
/ TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
+ String tid = Integer.toString(input.getTid());
- int type = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_TYPE_INDEX));
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
+ int type = input.getSyncType();
+ int apiType = input.getApiType();
+ String apiName = input.getApiName();
- String name = input.get(LogCenterConstants.SYNC_VAL_INDEX);
+ String name = Long.toString(input.getSyncValue());
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
+ long errorNum = input.getErrno();
ThreadPageSyncDataEvent event;
switch (type) {
case LogCenterConstants.SYNC_TYPE_PTHREAD_COND_VARIABLE:
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_INIT)) {
- syncAttrMap.put(
- input.get(LogCenterConstants.INPUTPARM_INDEX), -1);
+ syncAttrMap.put(input.getArgs(), -1);
} else if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_SETTYPE)) {
- checkMutexAttrType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexAttrType(input.getArgs());
} else {
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEX_INIT)) {
- checkMutexType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexType(input.getArgs());
}
event = new ThreadPageSyncDataEvent(name, type, apiType,
time, tid, apiName, errorNum, input);
}
}
- public List<List<String>> getLogsFromLogPackage(LogPackage logPack,
+ public List<LogData> getLogsFromLogPackage(LogPackage logPack,
int logCenterConstants) {
Logs logs = logPack.getLogs(logCenterConstants);
- if (null == logs || logs.getLogs().size() == 0) {
+ if (null == logs || null == logs.getLogs() || logs.getLogs().isEmpty()) {
return null;
}
- List<List<String>> ret = logs.getLogs();
+ List<LogData> ret = logs.getLogs();
return ret;
}
public void parsePageData(LogPackage logPack) {
- List<List<String>> inputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_SYNC);
+ List<LogData> inputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_PROBE_SYNC);
parseSyncs(inputs);
}
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
plot.setMarkers(board.getMarkers());
-
}
private boolean createSyncBoardItem(ThreadPageSyncData parent,
parent.pushEvent(event);
// child
data = parent.findChildData(event.getTid());
+
if (null == data) {
String attrType = parent.getAttrType();
data = new ThreadPageSyncData(
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageDataEvent;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncData;
protected int createChartItem(ThreadPageDataEvent event) {
int ret = -1;
- ThreadPageThreadDataEvent threadEvent = (ThreadPageThreadDataEvent) event;
- if (!(threadEvent instanceof ThreadPageThreadDataEvent)) {
+ if (!(event instanceof ThreadPageThreadDataEvent)) {
System.out.println("error : createChartItem");
return ret;
}
+
+ ThreadPageThreadDataEvent threadEvent = (ThreadPageThreadDataEvent) event;
DAChartSeriesItem seriesItem;
switch (threadEvent.getEventType()) {
.getCallerTid()));
setStartTime(String.valueOf(threadEvent.getTime()));
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_WAIT_END) {
- if (threadEvent.getContents()
- .get(LogCenterConstants.APINAME_INDEX)
- .equals(ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
+ ThreadData data = (ThreadData) threadEvent.getContents();
+ if (data.getApiName().equals(
+ ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
seriesItem = new DAChartSeriesItem(threadEvent.getTime(),
DAChartSeriesItem.SERIES_ARROW_LEFT,
ThreadPageLabels.THREAD_CHART_ITEM_JOINED);
int size = contentsQueue.size();
if (size > 0) {
+ ThreadPageDataEvent temp;
ThreadPageThreadDataEvent event;
for (int i = 0; i < size; i++) {
- event = (ThreadPageThreadDataEvent) contentsQueue.get(0);
- if ((event instanceof ThreadPageThreadDataEvent)) {
+ temp = contentsQueue.get(0);
+ if ((temp instanceof ThreadPageThreadDataEvent)) {
+ event = (ThreadPageThreadDataEvent) temp;
if (ThreadPageThreadDataEvent.TYPE_API == createChartItem(event)) {
contents.add(event);
}
*/
package org.tizen.dynamicanalyzer.ui.thread.thread;
-import java.util.List;
-
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageDataEvent;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
public static final int TYPE_API = 0;
public static final int TYPE_EVENT = 1;
public static final int TYPE_LOAD = 2;
- private ThreadPageThreadData data;
private int eventType = -1;
private int threadType = -1;
private DAChartSeriesItem chartItem;
public ThreadPageThreadDataEvent(int eventType, int threadType,
int apiType, double time, String tid, String tooltip,
- long errorNum, List<String> contents) {
+ long errorNum, LogData contents) {
super(time, tid, apiType, tooltip, errorNum, contents);
setEventType(eventType);
setThreadType(threadType);
this.chartItem = chartItem;
}
- public ThreadPageThreadData getData() {
- return data;
- }
-
public int getThreadType() {
return threadType;
}
import java.util.HashMap;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SyncData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
item.useExpand(true);
DAChart chart = item.getChart();
setChartSeries(chart);
+
setChartStyle(chart);
+
data.setItem(item);
item.setData(data);
chart.setData(data);
.getTimeline()));
plot.setMarkers(board.getMarkers());
-
}
private boolean createSyncBoardItem(ThreadPageThreadData data,
board.getVisibleEndTime());
DAContextMenu popupMenu = new DAContextMenu(chart);
+
popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
plot.setMarkers(board.getMarkers());
-
}
private void setChartSeries(DAChart chart) {
pushRow(mainData);
}
- public List<List<String>> getLogsFromLogPackage(LogPackage logPack,
+ public List<LogData> getLogsFromLogPackage(LogPackage logPack,
int logCenterConstants) {
if (false == isStart) {
createMainThreadItem();
if (null == logs || logs.getLogs().size() == 0) {
return null;
}
- List<List<String>> ret = logs.getLogs();
+ List<LogData> ret = logs.getLogs();
return ret;
}
- public void parseLoad(List<String> input) {
+ public void parseLoad(LogData input) {
if (false == isStart) {
createMainThreadItem();
}
return;
}
- if (Integer.valueOf(input.get(0)) != LogCenterConstants.LOG_DEVICE) {
+ if (!(input instanceof SystemData)) {
return;
}
+ SystemData sysLog = (SystemData) input;
String loads;
String tid;
int load;
- loads = input.get(LogCenterConstants.DEVICE_THREAD_LOAD_INDEX);
+ loads = sysLog.getThreadLoad();
+ // loads = input.get(LogCenterConstants.DEVICE_THREAD_LOAD_INDEX);
String[] temp = loads.split(",");
int tempSize = temp.length;
double time;
// }
load = (int) (Double.parseDouble(temp[j + 1]));
- time = Double.parseDouble(input
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ time = Double.parseDouble(Long.toString(input.getTime()))
/ TimelineConstants.MEGA;
ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time, tid,
}
private void parseLoad(LogPackage logPack) {
- List<List<String>> inputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_DEVICE);
+ List<LogData> inputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_DATA_SYSTEM);
int size;
if (null == inputs || 0 == (size = inputs.size())) {
return;
}
- List<String> input;
+ SystemData input;
String loads;
String tid;
int load;
for (int i = 0; i < size; i++) {
- input = inputs.get(i);
- loads = input.get(LogCenterConstants.DEVICE_THREAD_LOAD_INDEX);
+ input = (SystemData) inputs.get(i);
+ loads = input.getThreadLoad();
String[] temp = loads.split(",");
int tempSize = temp.length;
double time;
// }
load = (int) (Double.parseDouble(temp[j + 1]));
- time = Double.parseDouble(input
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ time = Double.parseDouble(Long.toString(input.getTime()))
/ TimelineConstants.MEGA;
ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time,
}
}
- private void parsePthread(List<String> input) {
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX)) / TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.THREAD_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
+ private void parsePthread(ThreadData input) {
+ double time = Double.parseDouble(Long.toString(input.getTime()))
+ / TimelineConstants.MEGA;
+ String tid = Integer.toString(input.getTid());
+ int apiType = input.getApiType();
+ String apiName = input.getApiName();
+ long errorNum = input.getErrno();
ThreadPageThreadDataEvent event;
+
switch (apiType) {
case LogCenterConstants.THREAD_API_TYPE_NEW:
case LogCenterConstants.THREAD_API_TYPE_STOP:
ThreadPageThreadDataEvent.TYPE_API,
LogCenterConstants.THREAD_TYPE_PTHREAD, apiType, time, tid,
apiName, errorNum, input);
- event.setCallID(input
- .get(LogCenterConstants.THREAD_PTHREAD_ID_INDEX));
+ event.setCallID(Long.toString(input.getPThreadId()));
+
pushEvent(event);
pushCallEvent(event);
break;
LogCenterConstants.THREAD_TYPE_PTHREAD, apiType, time, tid,
apiName, errorNum, input);
pushEvent(event);
- if (input.get(LogCenterConstants.APINAME_INDEX).equals(
+ if (input.getApiName().equals(
ThreadPageLabels.THREAD_API_PTHREAD_JOIN)) {
// join, delete warning
- AnalyzerManager
- .getWarningChecker()
- .removeData(
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + findCallerTid(input
- .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX)),
- WarningCase.JOINABLE_LEAK.getType());
+ AnalyzerManager.getWarningChecker().removeData(
+ ThreadPageLabels.THREAD_CHART_NAME_TID
+ + findCallerTid(Long.toString(input
+ .getOspThreadId())),
+ WarningCase.JOINABLE_LEAK.getType());
}
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP:
ThreadPageThreadDataEvent.TYPE_EVENT,
LogCenterConstants.THREAD_TYPE_PTHREAD, apiType, time, tid,
ThreadPageLabels.THREAD_CHART_ITEM_EXITED, errorNum, input);
- event.setCallID(input
- .get(LogCenterConstants.THREAD_PTHREAD_ID_INDEX));
+ event.setCallID(Long.toString(input.getPThreadId()));
pushEvent(event);
pushCallEvent(event);
if (true == isJoinableThread(tid)) {
// warningData
WarningData wData = new WarningData(
- LogCenterConstants.LOG_THREAD,
- WarningCase.JOINABLE_LEAK.getType(),
- event.getContents(),
+ WarningCase.JOINABLE_LEAK.getType(), input,
ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
AnalyzerManager.getWarningChecker().getWarningData().add(wData);
}
}
}
- private void parseTIZEN(List<String> input) {
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX)) / TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.THREAD_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
- String callID = input
- .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX);
+ private void parseTIZEN(ThreadData input) {
+ double time = Double.parseDouble(Long.toString(input.getTime()))
+ / TimelineConstants.MEGA;
+ String tid = Integer.toString(input.getTid());
+ int apiType = input.getApiType();
+ String apiName = input.getApiName();
+ String callID = Long.toString(input.getOspThreadId());
ThreadPageThreadData data;
ThreadPageThreadDataEvent event;
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
- // System.out.println("input : " + input);
+ long errorNum = input.getErrno();
switch (apiType) {
case LogCenterConstants.THREAD_API_TYPE_NEW:
case LogCenterConstants.THREAD_API_TYPE_STOP:
pushCallEvent(event);
break;
case LogCenterConstants.THREAD_API_TYPE_WAIT_END:
- if (input.get(LogCenterConstants.APINAME_INDEX).equals(
+ if (input.getApiName().equals(
ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
event = new ThreadPageThreadDataEvent(
ThreadPageThreadDataEvent.TYPE_EVENT,
tid, apiName, errorNum, input);
pushEvent(event);
// join, delete warning
- AnalyzerManager
- .getWarningChecker()
- .removeData(
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + findCallerTid(input
- .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX)),
- WarningCase.JOINABLE_LEAK.getType());
+ AnalyzerManager.getWarningChecker().removeData(
+ ThreadPageLabels.THREAD_CHART_NAME_TID
+ + findCallerTid(Long.toString(input
+ .getOspThreadId())),
+ WarningCase.JOINABLE_LEAK.getType());
} // FIXME : do not shows sleep's wait end
break;
ThreadPageThreadDataEvent.TYPE_EVENT,
LogCenterConstants.THREAD_TYPE_TIZEN, apiType, time, tid,
ThreadPageLabels.THREAD_CHART_ITEM_EXITED, errorNum, input);
- event.setCallID(input
- .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX));
+ event.setCallID(Long.toString(input.getOspThreadId()));
pushEvent(event);
pushCallEvent(event);
if (true == isJoinableThread(tid)) {
// warningData
WarningData wData = new WarningData(
- LogCenterConstants.LOG_THREAD,
WarningCase.JOINABLE_LEAK.getType(),
event.getContents(),
ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
}
}
- public void parseAPI(List<String> input) {
+ public void parseAPI(LogData input) {
if (null == input) {
return;
}
- if (Integer.valueOf(input.get(0)) != LogCenterConstants.LOG_THREAD) {
+ if (!(input instanceof ThreadData)) {
return;
}
-
+ ThreadData log = (ThreadData) input;
// System.out.println("input : " + input);
- int threadType = Integer.parseInt(input
- .get(LogCenterConstants.THREAD_TYPE_INDEX));
+ int threadType = log.getThreadType();
switch (threadType) {
case LogCenterConstants.THREAD_TYPE_PTHREAD:
- parsePthread(input);
+ parsePthread(log);
break;
case LogCenterConstants.THREAD_TYPE_TIZEN:
- parseTIZEN(input);
+ parseTIZEN(log);
break;
default:
System.out.println("thread page err: unknown thread type");
}
private void parseAPI(LogPackage logPack) {
- List<List<String>> inputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_THREAD);
+ List<LogData> inputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_PROBE_THREAD);
int size;
if (null == inputs || 0 == (size = inputs.size())) {
return;
}
- List<String> input;
+ ThreadData input;
for (int i = 0; i < size; i++) {
- input = inputs.get(i);
+ input = (ThreadData) inputs.get(i);
// System.out.println("input : " + input);
- int threadType = Integer.parseInt(input
- .get(LogCenterConstants.THREAD_TYPE_INDEX));
+ int threadType = input.getThreadType();
switch (threadType) {
case LogCenterConstants.THREAD_TYPE_PTHREAD:
}
}
- public void parseSync(List<String> input) {
- if (null == input) {
- return;
- }
-
- if (Integer.valueOf(input.get(0)) != LogCenterConstants.LOG_SYNC) {
+ public void parseSync(LogData input) {
+ if (null == input || !(input instanceof SyncData)) {
return;
}
-
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX)) / TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
+ SyncData syncData = (SyncData) input;
+ double time = Double.parseDouble(Long.toString(input.getTime()))
+ / TimelineConstants.MEGA;
+ String tid = Integer.toString(syncData.getTid());
// FIXME
- int type = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_TYPE_INDEX));
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
-
- String name = input.get(LogCenterConstants.SYNC_VAL_INDEX);
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
+ int type = syncData.getSyncType();
+ int apiType = syncData.getApiType();
+ String apiName = syncData.getApiName();
+
+ String name = Long.toString(syncData.getSyncValue());
+ long errorNum = syncData.getErrno();
ThreadPageSyncDataEvent event;
switch (type) {
case LogCenterConstants.SYNC_TYPE_TIZEN_MUTEX:
case LogCenterConstants.SYNC_TYPE_PTHREAD_COND_VARIABLE:
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_INIT)) {
- syncAttrMap.put(input.get(LogCenterConstants.INPUTPARM_INDEX),
- -1);
+ syncAttrMap.put(syncData.getArgs(), -1);
} else if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_SETTYPE)) {
- checkMutexAttrType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexAttrType(syncData.getArgs());
} else {
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEX_INIT)) {
- checkMutexType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexType(syncData.getArgs());
}
event = new ThreadPageSyncDataEvent(name, type, apiType, time,
tid, apiName, errorNum, input);
}
private void parseSync(LogPackage logPack) {
- List<List<String>> inputs = getLogsFromLogPackage(logPack,
- LogCenterConstants.LOG_SYNC);
+ List<LogData> inputs = getLogsFromLogPackage(logPack,
+ AnalyzerConstants.MSG_PROBE_SYNC);
int size;
if (null == inputs || 0 == (size = inputs.size())) {
return;
}
- List<String> input;
+ SyncData input;
for (int i = 0; i < size; i++) {
- input = inputs.get(i);
- double time = Double.parseDouble(input
- .get(LogCenterConstants.TIME_INDEX))
+ input = (SyncData) inputs.get(i);
+ double time = Double.parseDouble(Long.toString(input.getTime()))
/ TimelineConstants.MEGA;
- String tid = input.get(LogCenterConstants.THREAD_ID_INDEX);
+ String tid = Integer.toString(input.getTid());
// FIXME
- int type = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_TYPE_INDEX));
- int apiType = Integer.parseInt(input
- .get(LogCenterConstants.SYNC_API_TYPE_INDEX));
- String apiName = input.get(LogCenterConstants.APINAME_INDEX);
-
- String name = input.get(LogCenterConstants.SYNC_VAL_INDEX);
- long errorNum = Long.parseLong(input
- .get(LogCenterConstants.ERROR_INDEX));
+ int type = input.getSyncType();
+ int apiType = input.getApiType();
+ String apiName = input.getApiName();
+
+ String name = Long.toString(input.getSyncValue());
+ long errorNum = input.getErrno();
ThreadPageSyncDataEvent event;
switch (type) {
case LogCenterConstants.SYNC_TYPE_TIZEN_MUTEX:
case LogCenterConstants.SYNC_TYPE_PTHREAD_COND_VARIABLE:
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_INIT)) {
- syncAttrMap.put(
- input.get(LogCenterConstants.INPUTPARM_INDEX), -1);
+ syncAttrMap.put(input.getArgs(), -1);
} else if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEXATTR_SETTYPE)) {
- checkMutexAttrType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexAttrType(input.getArgs());
} else {
if (apiName
.equals(ThreadPageLabels.SYNC_API_PTHREAD_MUTEX_INIT)) {
- checkMutexType(input
- .get(LogCenterConstants.INPUTPARM_INDEX));
+ checkMutexType(input.getArgs());
}
event = new ThreadPageSyncDataEvent(name, type, apiType,
time, tid, apiName, errorNum, input);
if (event.getApiType() != LogCenterConstants.THREAD_API_TYPE_INTERNAL_START) {
continue;
}
- if (callID.equals(event.getCallID())) {
+ if (callID == event.getCallID()) {
return event.getTid();
}
}
}
int apiType = event.getApiType();
int threadType = event.getThreadType();
+ ThreadData tData = (ThreadData) event.getContents();
if (LogCenterConstants.THREAD_API_TYPE_INTERNAL_START == apiType) {
int callEventQueueSize = callEventQueue.size();
ThreadPageThreadDataEvent callEvent;
} else {
if (threadType == LogCenterConstants.THREAD_TYPE_TIZEN) {
String callerTizenID = callEvent.getCallID();
- String eventTizenID = event.getContents().get(
- LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX);
+ String eventTizenID = Long.toString(tData
+ .getOspThreadId());
if (eventTizenID.equals(callerTizenID)) {
event.setCallerTid(callEvent.getTid());
callEventQueue.remove(i);
}
} else {
String callerPthreadID = callEvent.getCallID();
- String eventPthreadID = event.getContents().get(
- LogCenterConstants.THREAD_PTHREAD_ID_INDEX);
+ String eventPthreadID = Long.toString(tData
+ .getOspThreadId());
if (eventPthreadID.equals(callerPthreadID)) {
event.setCallerTid(callEvent.getTid());
callEventQueue.remove(i);
}
return false;
} else if (LogCenterConstants.THREAD_API_TYPE_WAIT_END == apiType) {
- if (!event.getContents().get(LogCenterConstants.APINAME_INDEX)
- .equals(ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
+ if (!tData.getApiName().equals(
+ ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
return true;
}
} else {
if (threadType == LogCenterConstants.THREAD_TYPE_TIZEN) {
String callerTizenID = callEvent.getCallID();
- String eventTizenID = event.getContents().get(
- LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX);
+ String eventTizenID = Long.toString(tData
+ .getOspThreadId());
if (eventTizenID.equals(callerTizenID)) {
event.setCallerTid(callEvent.getTid());
if (null == callEvent.getChartItem()) {
}
} else {
String callerPthreadID = callEvent.getCallID();
- String eventPthreadID = event.getContents().get(
- LogCenterConstants.THREAD_PTHREAD_ID_INDEX);
+ String eventPthreadID = Long.toString(tData
+ .getOspThreadId());
if (eventPthreadID.equals(callerPthreadID)) {
event.setCallerTid(callEvent.getTid());
if (null == callEvent.getChartItem()) {
} else {
hasUpdate = false;
}
+
int size = rowsQueue.size();
if (size > 0) {
ThreadPageThreadData data;
eventQueue.clear();
callEventQueue.clear();
syncAttrMap.clear();
+ callRowsQueue.clear();
+ syncEventQueue.clear();
hasUpdate = false;
}
}
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class CallTraceTable extends DATableComposite {
return;
}
int size = ti.length;
- List<String> startData = ((DATableDataFormat) ti[0].getData())
- .getData();
- List<String> endData = ((DATableDataFormat) ti[size - 1]
- .getData()).getData();
- long startTime = Long.parseLong(startData
- .get(LogCenterConstants.TIME_INDEX));
- long endTime = Long.parseLong(endData
- .get(LogCenterConstants.TIME_INDEX));
+ LogData startData = ((DATableDataFormat) ti[0].getData())
+ .getLogData();
+ LogData endData = ((DATableDataFormat) ti[size - 1].getData())
+ .getLogData();
+ long startTime = startData.getTime();
+ long endTime = endData.getTime();
DASelectionData data = new DASelectionData(CallTraceView.ID,
startTime, endTime, ti, table);
}
protected List<TableInput> makeTableInput() {
- List<List<String>> userLog = UserFunctionManager.getInstance().getLog();
+ List<LogData> userLog = UserFunctionManager.getInstance().getLog();
List<TableInput> input = new ArrayList<TableInput>();
int size = userLog.size();
for (int i = 0; i < size; i++) {
// create text
+ UserFunctionData data = (UserFunctionData) userLog.get(i);
List<String> text = new ArrayList<String>();
- String time = Formatter.toTimeFormat(userLog.get(i).get(
- LogCenterConstants.TIME_INDEX));
+ String time = Formatter.toTimeFormat(data.getTime());
text.add(time);
- text.add(userLog.get(i).get(LogCenterConstants.THREAD_ID_INDEX));
- text.add(new String(userLog.get(i).get(
- LogCenterConstants.APINAME_INDEX)));
+ text.add(Integer.toString(data.getTid()));
+ text.add(data.getApiName());
// create images
// create DATableDataFormat
- DATableDataFormat tableData = new DATableDataFormat(userLog.get(i)
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- tableData.getData().addAll(userLog.get(i));
+ DATableDataFormat tableData = new DATableDataFormat(data.getSeq());
+ tableData.setLogData(data);
TableInput tableInput = new TableInput();
tableInput.setText(text);
input.add(tableInput);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- long logTime = Long.parseLong(userLog.get(i).get(
- LogCenterConstants.TIME_INDEX));
- long analysisStartTime = RangeDataManager.getInstance().getAnalysisStartTime();
- long analysisEndTime = RangeDataManager.getInstance().getAnalysisEndTime();
+ long logTime = data.getTime();
+ long analysisStartTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
+ long analysisEndTime = RangeDataManager.getInstance()
+ .getAnalysisEndTime();
if (logTime >= analysisStartTime && logTime <= analysisEndTime) {
tableInput.setInRange(true);
}
}
return chartBoard;
}
-
+
protected void actionSetStartEnd(int type) {
GridItem item = table.getItem(mousePoint);
if (null != item) {
- List<String> data = ((DATableDataFormat) item.getData()).getData();
- String time = data.get(LogCenterConstants.TIME_INDEX);
- long inputTime = -1;
- try {
- inputTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
+ LogData data = ((DATableDataFormat) item.getData()).getLogData();
+ long inputTime = data.getTime();
+ double startTime = -1;
+ double endTime = -1;
+ DAChartBoard board = getChartBoard();
+
if (type == START_TIME) {
rangeDataManager.setMarkerStartTime(inputTime);
- getChartBoard().setTimelineMarkerStartTime(
- inputTime / TimelineConstants.MEGA);
+ startTime = inputTime / TimelineConstants.MEGA;
+ endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
} else if (type == END_TIME) {
rangeDataManager.setMarkerEndTime(inputTime);
- getChartBoard().setTimelineMarkerEndTime(
- inputTime / TimelineConstants.MEGA);
+ endTime = inputTime / TimelineConstants.MEGA;
+ startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
+ }
+
+ board.setTimelineMarkerStartTime(startTime);
+ board.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ //
+ //
+ //
+ //
+ // if (type == START_TIME) {
+ // rangeDataManager.setMarkerStartTime(inputTime);
+ // getChartBoard().setTimelineMarkerStartTime(
+ // inputTime / TimelineConstants.MEGA);
+ // } else if (type == END_TIME) {
+ // rangeDataManager.setMarkerEndTime(inputTime);
+ // getChartBoard().setTimelineMarkerEndTime(
+ // inputTime / TimelineConstants.MEGA);
+ // }
+ }
+ }
+
+ public void setSelectionByTime(long startTime, long endTime) {
+ GridItem[] items = table.getItems();
+ int size = items.length;
+ List<Integer> selectionArray = new ArrayList<Integer>();
+ int topIndex = 0;
+ long topIndexTime = 0;
+
+ for (int i = 0; i < size; i++) {
+ DATableDataFormat dataFormat = (DATableDataFormat) items[i]
+ .getData();
+ long time = dataFormat.getLogData().getTime();
+
+ if (time < startTime) {
+ if (time > topIndexTime) {
+ topIndexTime = time;
+ topIndex = i;
+ }
+ } else if (time <= endTime) {
+ if (topIndexTime < startTime) {
+ topIndexTime = time;
+ topIndex = i;
+ } else {
+ if (topIndexTime > time) {
+ topIndexTime = time;
+ topIndex = i;
+ }
+ }
+ selectionArray.add(i);
+ } else {
+ break;
}
}
+
+ int[] sel = new int[selectionArray.size()];
+ for (int i = 0; i < sel.length; i++) {
+ sel[i] = selectionArray.get(i).intValue();
+ }
+ table.setSelection(sel);
+ table.setTopIndex(topIndex);
}
}
import java.util.List;
-import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.TimelinePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
public void updateView(DASelectionData selData) {
long start = selData.getStartTime();
long end = selData.getEndTime();
-
- int selectionIndex = SqlManager.getInstance()
- .executeSelectIndexOperation(start);
- int selectionCount = SqlManager.getInstance()
- .executeSelectCountOperation(start, end);
-
- selectionIndex = ((selectionIndex < 0) && (selectionCount > 0)) ? 0
- : selectionIndex;
- tableComp.getTable().getVerticalBar().setSelection(selectionIndex);
updateView();
-
- Grid table = tableComp.getTable();
- if (selectionIndex >= 0) {
- if (selectionCount > 0) {
- int selections[] = new int[selectionCount];
- for (int i = 0; i < selectionCount; i++) {
- selections[i] = selectionIndex + i;
- }
- table.setSelection(selections);
- } else {
- int selections[] = new int[0];
- table.setSelection(selections);
- int itemCount = table.getItemCount();
- if (selectionIndex >= itemCount) {
- selectionIndex = itemCount - 1;
- }
- table.setSelection(selectionIndex);
- }
- }
+ ((CallTraceTable)tableComp).setSelectionByTime(start, end);
+ updateView();
/* only callstack update */
// timeline view and tabcomp top view : callstack
if (selData.getViewId().equals(TimelineView.ID)) {
@Override
public void updateLog(LogPackage logPack) {
Logs logs = logPack.getLogs(LogCenterConstants.LOG_USER_FUNCTION);
- if (null == logs || logs.getLogs().size() == 0) {
+ if (null == logs || null == logs.getLogs() || logs.getLogs().isEmpty()) {
return;
}
- List<List<String>> inputs = logs.getLogs();
+ List<LogData> inputs = logs.getLogs();
- List<List<String>> userLog = UserFunctionManager.getInstance().getLog();
+ List<LogData> userLog = UserFunctionManager.getInstance().getLog();
int size = inputs.size();
for (int i = 0; i < size; i++) {
- List<String> input = inputs.get(i);
- int type = Integer.parseInt(input
- .get(LogCenterConstants.USER_FUNCTION_TYPE_INDEX));
+ UserFunctionData input = (UserFunctionData) inputs.get(i);
+ int type = input.getType();
if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER) {
userLog.add(input);
}
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
public class UserFunctionManager {
- private List<List<String>> log = null;
+ private List<LogData> log = null;
private static UserFunctionManager instance = null;
public static UserFunctionManager getInstance() {
instance = null;
}
- public UserFunctionManager() {
- log = new ArrayList<List<String>>();
- }
-
- public List<List<String>> getLog() {
+ public List<LogData> getLog() {
if (null == log) {
- log = new ArrayList<List<String>>();
+ log = new ArrayList<LogData>();
}
return log;
}
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
private CPUChart() {
chartType = TimelineConstants.CHART_TYPE_CPU;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.CPU_CHART_TITLE;
chartIcon = ImageResources.CHART_CPU;
addIcon = ImageResources.ADD_CHART_CPU;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ List<LogData> logList = logs.getLogs();
+ for (LogData log : logList) {
+ parsingLog((SystemData) log);
}
}
- private void parsingLog(List<String> log) {
- if (null == log || 0 > log.size()) {
+ private void parsingLog(SystemData log) {
+ if (null == log) {
return;
}
/* app load */
- if (!log.get(LogCenterConstants.DEVICE_APP_CPU_USAGE_INDEX).isEmpty()) {
+ if (log.getAppCpuUsage() != 0) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ double time = Double.parseDouble(Long.toString(log.getTime()))
/ TimelineConstants.MEGA;
- double appCpuRate = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_APP_CPU_USAGE_INDEX));
+ double appCpuRate = log.getAppCpuUsage();
appLoadSeries.addSeriesItem(new DAChartSeriesItem(time,
appCpuRate, Formatter.toPercentageFormat(appCpuRate)));
} catch (NumberFormatException ne) {
}
/* total load */
- if (!log.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
- .isEmpty()) {
+ if (!log.getCpuLoad().isEmpty()) {
double time = 0;
double systemAvgLoad = 0;
try {
- time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- String[] cpuRates = log.get(
- LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
- .split(","); //$NON-NLS-1$
+ time = Double.parseDouble(Long.toString(log.getTime()))
+ / (TimelineConstants.MEGA);
+ String[] cpuRates = log.getCpuLoad().split(
+ CommonConstants.COMMA);
systemAvgLoad = Double
.parseDouble(cpuRates[cpuRates.length - 1]);
totalLoadSeries.addSeriesItem(new DAChartSeriesItem(time,
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
public CPUCoreChart() {
chartType = TimelineConstants.CHART_TYPE_CPU_CORE;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.CPU_CORE_CHART_TITLE;
chartIcon = ImageResources.CHART_CPU_CORE;
addIcon = ImageResources.ADD_CHART_CPU_CORE;
return item;
}
- private void parsingLog(List<String> log) {
- if (null == log || 0 > log.size()) {
+ private void parsingLog(SystemData log) {
+ if (null == log) {
return;
}
- if (!log.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
- .isEmpty()) {
+ if (!log.getCpuLoad().isEmpty()) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ double time = Double.parseDouble(Long.toString(log.getTime()))
/ TimelineConstants.MEGA;
- String[] cpuRates = log.get(
- LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
- .split(","); //$NON-NLS-1$
+ String[] cpuRates = log.getCpuLoad().split(
+ CommonConstants.COMMA);
double value = 0;
if (coreSize == TimelineConstants.NOT_INITED) {
coreSize = cpuRates.length - 1;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((SystemData) log);
}
}
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
private CPUFrequencyChart() {
chartType = TimelineConstants.CHART_TYPE_CPU_FREQUENCY;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.CPU_FREQUENCY_CHART_TITLE;
chartIcon = ImageResources.CHART_CPU_FREQUENCY;
addIcon = ImageResources.ADD_CHART_CPU_FREQUENCY;
DAChartBoardItem item = super.createBoardItem(board);
chart.addSeries(frequencySeries);
-
+
chart.getPlot().setAxisUnit("Hz");
chart.getPlot().setShowAxis(true);
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((SystemData) log);
}
}
- private void parsingLog(List<String> log) {
- if (null == log || 0 > log.size()) {
+ private void parsingLog(SystemData log) {
+ if (null == log) {
return;
}
- if (!log.get(LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX).isEmpty()) {
+ if (!log.getCpuFrequency().isEmpty()) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ double time = Double.parseDouble(Long.toString(log.getTime()))
/ TimelineConstants.MEGA;
- String[] cpuFreqs = log.get(
- LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX).split(
- ","); //$NON-NLS-1$
+ String[] cpuFreqs = log.getCpuFrequency().split(
+ CommonConstants.COMMA);
double freq0 = Double.parseDouble(cpuFreqs[0]) * (double) 1000;
frequencySeries.addSeriesItem(new DAChartSeriesItem(time,
import java.util.List;
import java.util.Map;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
public class FileChart extends TimelineChart {
- private class FDCountData {
+ private static class FDCountData {
private int type;
private double time;
private long data;
private static FileChart instance = null;
- private final int MIN_FDCOUNT = 5;
- private final int MIN_READ_WRITE_BYTE = 0;
+ private static final int MIN_FDCOUNT = 5;
+ private static final int MIN_READ_WRITE_BYTE = 0;
- private final int TYPE_FDCOUNT = 0;
- private final int TYPE_READ = 1;
- private final int TYPE_WRITE = 2;
+ private static final int TYPE_FDCOUNT = 0;
+ private static final int TYPE_READ = 1;
+ private static final int TYPE_WRITE = 2;
private long maxFDCount = MIN_FDCOUNT;
private double maxReadWrite = MIN_READ_WRITE_BYTE;
private FileChart() {
chartType = TimelineConstants.CHART_TYPE_FILE;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.FILE_CHART_TITLE;
chartIcon = ImageResources.CHART_FILE;
addIcon = ImageResources.ADD_CHART_FILE;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
- for (List<String> log : logList) {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX));
+ List<LogData> logList = logs.getLogs();
+ for (LogData log : logList) {
+ double time = Double.parseDouble(Long.toString(log.getTime()));
int size = deviceLogTimeList.size();
int index = (int) (time / TimelineConstants.MEGA);
int i;
for (i = flat; i < deviceLogTimeList.size(); i++) {
Double deviceLogTime = deviceLogTimeList.get(i);
- if (deviceLogTime == Double.NaN || deviceLogTime < time) {
+ if (deviceLogTime.isNaN() || deviceLogTime < time) {
continue;
}
import java.util.HashMap;
import java.util.List;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.MemoryData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
public class HeapChart extends TimelineChart {
- private final int MEM_API_TYPE_ALLOC = 0;
- private final int MEM_API_TYPE_FREE = 1;
- private final int MEM_API_TYPE_MANAGE = 2;
- private final int MEM_USER = 2;
+ private static final int MEM_API_TYPE_ALLOC = 0;
+ private static final int MEM_API_TYPE_FREE = 1;
+ private static final int MEM_API_TYPE_MANAGE = 2;
+ private static final int MEM_USER = 2;
private static HeapChart instance = null;
- private final String NIL = "(nil)"; //$NON-NLS-1$
+ // private static final String NIL = "(nil)"; //$NON-NLS-1$
private DAChartSeries totalAllocationSeries;
private DAChartSeries userAllocationSeries;
private double allocByte = 0;
- private HashMap<String, Double> allocationSeriesDataSetMap = new HashMap<String, Double>();
+ private HashMap<Long, Double> allocationSeriesDataSetMap = new HashMap<Long, Double>();
public static HeapChart getInstance() {
if (instance == null) {
private HeapChart() {
chartType = TimelineConstants.CHART_TYPE_HEAP;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.HEAP_CHART_TITLE;
chartIcon = ImageResources.CHART_HEAP;
addIcon = ImageResources.ADD_CHART_HEAP;
@Override
public void parseLogPackage(LogPackage logPack) {
- Logs memoryLogs = logPack.getLogs(LogCenterConstants.LOG_MEMORY);
- Logs deviceLogs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+ Logs memoryLogs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_MEMORY);
+ Logs deviceLogs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM);
- List<List<String>> memoryLogList = memoryLogs == null ? null
- : memoryLogs.getLogs();
- List<List<String>> deviceLogList = deviceLogs == null ? null
- : deviceLogs.getLogs();
+ List<LogData> memoryLogList = (memoryLogs == null) ? null : memoryLogs
+ .getLogs();
+ List<LogData> deviceLogList = (deviceLogs == null) ? null : deviceLogs
+ .getLogs();
parsingLog(memoryLogList, deviceLogList);
}
- private void parsingLog(List<List<String>> memoryLogList,
- List<List<String>> deviceLogList) {
+ private void parsingLog(List<LogData> memoryLogList,
+ List<LogData> deviceLogList) {
boolean isUserAllocUpdated = false;
/* user alloc */
try {
- if (memoryLogList != null) {
+ if (memoryLogList != null && !memoryLogList.isEmpty()) {
int size = memoryLogList.size();
for (int i = 0; i < size; i++) {
- List<String> log = memoryLogList.get(i);
- if (log != null && log.size() > 0) {
- int memApiType = Integer.parseInt(log
- .get(LogCenterConstants.MEMORY_APITYPE_INDEX));
- int internalFlag = Integer.parseInt(log
- .get(LogCenterConstants.INTERNAL_FLAG_INDEX));
- long errorNo = Long.parseLong(log
- .get(LogCenterConstants.ERROR_INDEX));
+ MemoryData log = (MemoryData) memoryLogList.get(i);
+ if (log != null) {
+ int memApiType = log.getMemoryApiType();
+ int internalFlag = log.getInternalCall();
+ long errorNo = log.getErrno();
if (errorNo == 0 && MEM_USER == internalFlag) {
if (MEM_API_TYPE_ALLOC == memApiType
|| MEM_API_TYPE_FREE == memApiType
|| MEM_API_TYPE_MANAGE == memApiType) {
double time = 0;
- time = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX))
- / TimelineConstants.MEGA;
+ time = Double.parseDouble(Long.toString(log
+ .getTime())) / TimelineConstants.MEGA;
isUserAllocUpdated = addNewSeriesUserAllocData(
memApiType, time, log);
if (deviceLogList != null) {
int size = deviceLogList.size();
for (int i = 0; i < size; i++) {
- List<String> log = deviceLogList.get(i);
- if (log != null && log.size() > 0) {
- if (!log.get(
- LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX)
- .isEmpty()) {
-
- double time = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX))
+ SystemData log = (SystemData) deviceLogList.get(i);
+ if (log != null) {
+ if (log.getTotalAllocSize() != 0) {
+ double time = ((double) log.getTime())
/ TimelineConstants.MEGA;
- double value = Double
- .parseDouble(log
- .get(LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX))
+ double value = (double) log.getTotalAllocSize()
- allocByte;
totalAllocationSeries
.addSeriesItem(new DAChartSeriesItem(time,
}
private boolean addNewSeriesUserAllocData(int fdApiType, double time,
- List<String> log) {
+ MemoryData log) {
double size = 0;
- String addressString = log.get(LogCenterConstants.MEMORY_ADDR_INDEX);
- if (addressString.equals(NIL)) {
+ // String addressString = log.get(LogCenterConstants.MEMORY_ADDR_INDEX);
+ // if (addressString.equals(NIL)) {
+ // return false;
+ // }
+ long address = log.getAddress();
+ if (0 == address) {
return false;
}
if (MEM_API_TYPE_ALLOC == fdApiType) {
- if (log.get(LogCenterConstants.MEMORY_SIZE_INDEX).isEmpty()) {
+ if (log.getSize() == 0) {
return false;
}
try {
- size = Double.parseDouble(log
- .get(LogCenterConstants.MEMORY_SIZE_INDEX));
-
+ size = (double) log.getSize();
allocByte += size;
- allocationSeriesDataSetMap.put(addressString, size);
+ allocationSeriesDataSetMap.put(address, size);
} catch (NumberFormatException ne) {
ne.printStackTrace();
}
} else if (MEM_API_TYPE_FREE == fdApiType) {
- if (!allocationSeriesDataSetMap.containsKey(addressString)) {
+ if (!allocationSeriesDataSetMap.containsKey(address)) {
return false;
}
- size = allocationSeriesDataSetMap.get(addressString);
+ size = allocationSeriesDataSetMap.get(address);
allocByte -= size;
}
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
private ProcessMemoryChart() {
chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
chartIcon = ImageResources.CHART_PROCESS_MEMORY;
addIcon = ImageResources.ADD_CHART_PROCESS_MEMORY;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((SystemData) log);
}
}
- private void parsingLog(List<String> log) {
+ private void parsingLog(SystemData log) {
/* VSS */
- if (!log.get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX).isEmpty()) {
- try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- double value = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX));
-
- VSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time,
- value, Formatter.toByteFormat(value)));
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- }
+ if (log.getVirtualMemory() != 0) {
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
+ double value = (double) log.getVirtualMemory();
+
+ VSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
+ Formatter.toByteFormat(value)));
}
/* RSS */
- if (!log.get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX).isEmpty()) {
- try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- double value = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX));
-
- RSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time,
- value, Formatter.toByteFormat(value)));
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- }
+ if (log.getResidentMemory() != 0) {
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
+ double value = (double) log.getResidentMemory();
+
+ RSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
+ Formatter.toByteFormat(value)));
}
/* PSS */
- if (!log.get(LogCenterConstants.DEVICE_PSS_MEMORY_INDEX).isEmpty()) {
- try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- double value = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_PSS_MEMORY_INDEX));
-
- PSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time,
- value, Formatter.toByteFormat(value)));
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- }
+ if (log.getPSSMemory() != 0) {
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
+ double value = (double) log.getPSSMemory();
+
+ PSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
+ Formatter.toByteFormat(value)));
}
}
}
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ScreenShotData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
private ScreenshotChart() {
chartType = TimelineConstants.CHART_TYPE_SCREENSHOT;
chartStyle = DAChart.CHART_STYLE_SCREENSHOT;
- probeType = LogCenterConstants.LOG_SCREENSHOT;
+ probeType = AnalyzerConstants.MSG_PROBE_SCREENSHOT;
chartName = TimelineChartLabels.SCREENSHOT_CHART_TITLE;
chartIcon = ImageResources.CHART_SCREENSHOT;
addIcon = ImageResources.ADD_CHART_SCREENSHOT;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ if (null == logs) {
+ return;
+ }
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((ScreenShotData) log);
}
}
- private void parsingLog(List<String> log) {
+ private void parsingLog(ScreenShotData log) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX))
- / TimelineConstants.MEGA;
-
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
String imagePath = AnalyzerManager.getProject().getSavePath()
+ File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+ File.separator
+ AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME;
- String imagePathLog = log
- .get(LogCenterConstants.SNAPSHOT_IMAGE_PATH_INDEX);
+ String imagePathLog = log.getImageFilePath();
String[] splitedImagePathLog = imagePathLog.split("/"); //$NON-NLS-1$
String fileName = splitedImagePathLog[splitedImagePathLog.length - 1];
imagePath += File.separator + fileName;
- String orientation = log
- .get(LogCenterConstants.SNAPSHOT_ROTATE_INDEX);
+ int orientation = log.getOrientation();
int yPostion;
- if (orientation.equals("0") || orientation.equals("180")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (orientation == 0 || orientation == 180) {
yPostion = 10;
} else {
yPostion = 23;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
private SystemMemoryChart() {
chartType = TimelineConstants.CHART_TYPE_SYSTEM_MEMORY;
- probeType = LogCenterConstants.LOG_DEVICE;
+ probeType = AnalyzerConstants.MSG_DATA_SYSTEM;
chartName = TimelineChartLabels.SYSTEM_MEMORY_CHART_TITLE;
chartIcon = ImageResources.CHART_SYSTEM_MEMORY;
addIcon = ImageResources.ADD_CHART_SYSTEM_MEMORY;
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((SystemData) log);
}
}
- private void parsingLog(List<String> log) {
- if (null == log || 0 > log.size()) {
+ private void parsingLog(SystemData log) {
+ if (null == log) {
return;
}
/* process */
- if (!log.get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX).isEmpty()) {
- try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
- double usage = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX));
- processSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
- Formatter.toByteFormat(usage)));
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- }
+ if (log.getResidentMemory() != 0) {
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
+ double usage = (double) log.getResidentMemory();
+ processSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
+ Formatter.toByteFormat(usage)));
}
/* system & total */
- if (!log.get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX)
- .isEmpty()) {
- try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
- / TimelineConstants.MEGA;
-
- double usage = Double
- .parseDouble(log
- .get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX));
- double total = (double) AnalyzerManager.getProject()
- .getSystemMemorySize();
-
- systemSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
- Formatter.toByteFormat(usage)));
- totalSeries.addSeriesItem(new DAChartSeriesItem(time, total,
- Formatter.toByteFormat(total)));
- } catch (NumberFormatException ne) {
- ne.printStackTrace();
- }
+ if (log.getUsedSystemMemory() != 0) {
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
+
+ double usage = (double) log.getUsedSystemMemory();
+ double total = (double) AnalyzerManager.getProject()
+ .getSystemMemorySize();
+
+ systemSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
+ Formatter.toByteFormat(usage)));
+ totalSeries.addSeriesItem(new DAChartSeriesItem(time, total,
+ Formatter.toByteFormat(total)));
}
}
}
import java.util.List;
import org.eclipse.swt.graphics.Image;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
public abstract class TimelineChart {
protected DAChart chart;
- protected int chartType;
+ protected long chartType;
protected int chartStyle = DAChart.CHART_STYLE_NORMAL;
protected int probeType;
protected String chartName;
}
}
- public int getChartType() {
+ public long getChartType() {
return chartType;
}
import java.util.List;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.UIEventData;
import org.tizen.dynamicanalyzer.ui.common.UIEventChartContextMenuItem;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.uievent.UIEventListDialog;
private DAChartSeries gestureEventSeries;
private DAChartSeries orientationEventSeries;
- private final int TYPE_TOUCH = 2;
- private final int TYPE_GESTURE = 3;
- private final int TYPE_ORIENTATION = 4;
+ private static final int TYPE_TOUCH = 2;
+ private static final int TYPE_GESTURE = 3;
+ private static final int TYPE_ORIENTATION = 4;
- private final int GESTURE_TYPE_FLICK = 0;
- private final int GESTURE_TYPE_LONG_PRESS = 1;
- private final int GESTURE_TYPE_PANNING = 2;
- private final int GESTURE_TYPE_PINCH = 3;
- private final int GESTURE_TYPE_ROTATION = 4;
- private final int GESTURE_TYPE_TAP = 5;
+ private static final int GESTURE_TYPE_FLICK = 0;
+ private static final int GESTURE_TYPE_LONG_PRESS = 1;
+ private static final int GESTURE_TYPE_PANNING = 2;
+ private static final int GESTURE_TYPE_PINCH = 3;
+ private static final int GESTURE_TYPE_ROTATION = 4;
+ private static final int GESTURE_TYPE_TAP = 5;
- private final String NEW_LINE = CommonConstants.NEW_LINE;
+ private static final String NEW_LINE = CommonConstants.NEW_LINE;
private UIEventListDialog uiEventListDialog = new UIEventListDialog(
AnalyzerUtil.getWorkbenchWindow().getShell());
private UIEventChart() {
chartType = TimelineConstants.CHART_TYPE_UIEVENT;
chartStyle = DAChart.CHART_STYLE_MULTI;
- probeType = LogCenterConstants.LOG_RECODER;
+ probeType = AnalyzerConstants.MSG_PROBE_UIEVENT;
chartName = TimelineChartLabels.UI_EVENT_CHART_TITLE;
chartIcon = ImageResources.CHART_UI_EVENT;
addIcon = ImageResources.ADD_CHART_UI_EVENT;
eventListItem.addClickListener(new DAContextMenuListener() {
@Override
public void widgetSelected(DAContextMenuItem menuItem) {
- int startIndex = eventListItem.getEventListStartIndex();
- int endIndex = eventListItem.getEventListEndIndex();
- int seriesIndex = eventListItem.getSeriesIndex();
-
- if (startIndex < 0 || endIndex < 0 || seriesIndex < 0) {
- return;
- }
-
- uiEventListDialog.setSeriesItemInfo(
- chart.getSeries(seriesIndex), startIndex, endIndex + 1);
+ List<DAChartSeries> chartSeriesList = eventListItem
+ .getChartSeriesList();
+ List<Integer> startIndexList = eventListItem
+ .getStartIndexList();
+ List<Integer> endIndexList = eventListItem.getEndIndexList();
+
+ uiEventListDialog.setSelectedEventInfo(chartSeriesList,
+ startIndexList, endIndexList);
uiEventListDialog.open();
}
});
@Override
public void parseLogPackage(LogPackage logPack) {
Logs logs = logPack.getLogs(probeType);
- List<List<String>> logList = logs.getLogs();
+ if (null == logs) {
+ return;
+ }
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((UIEventData) log);
}
}
- private void parsingLog(List<String> log) {
+ private void parsingLog(UIEventData log) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX))
- / TimelineConstants.MEGA;
+ double time = ((double) log.getTime()) / TimelineConstants.MEGA;
int detailType;
- int type = Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_EVENT_TYPE));
+ int type = log.getEventType();
String info;
switch (type) {
case TYPE_TOUCH:
- detailType = Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_DETAIL_TYPE));
+ detailType = log.getDetailType();
info = EnumTouchStatus.values()[detailType].getStatus()
- + NEW_LINE + "X : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_X) + " Y : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_Y);
+ + NEW_LINE + "X : " + log.getX() + " Y : " + log.getY();
touchEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0,
info));
break;
case TYPE_GESTURE:
- detailType = Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_DETAIL_TYPE));
+ detailType = log.getDetailType();
gestureEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0,
getGestureInfo(detailType, log)));
break;
case TYPE_ORIENTATION:
- int status = Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_INFO1));
+ int status = log.getInfo1();
orientationEventSeries.addSeriesItem(new DAChartSeriesItem(
time, 0, TimelineChartLabels.UIEVENT_ORIENTATION
+ " "//$NON-NLS-1$
}
}
- private String getGestureInfo(int detailType, List<String> log) {
+ private String getGestureInfo(int detailType, UIEventData log) {
String info = CommonConstants.EMPTY;
switch (detailType) {
case GESTURE_TYPE_FLICK:
info = TimelineChartLabels.UIEVENT_GESTURE_FLICK
+ " "//$NON-NLS-1$
- + getFlickDirection(Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_INFO2)))
+ + getFlickDirection(log.getInfo2())
+ NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DISTANCE
+ " X : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_X) + NEW_LINE
+ + log.getX() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DISTANCE
+ " Y : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_Y) + NEW_LINE
+ + log.getY() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO1);
+ + log.getInfo1();
break;
case GESTURE_TYPE_LONG_PRESS:
info = TimelineChartLabels.UIEVENT_GESTURE_LONG_PRESS
+ NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_X) + NEW_LINE
+ + log.getX() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO2) + NEW_LINE
+ + log.getInfo2() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO1);
+ + log.getInfo1();
break;
case GESTURE_TYPE_PANNING:
info = TimelineChartLabels.UIEVENT_GESTURE_PANNING + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO2);
+ + log.getInfo2();
break;
case GESTURE_TYPE_PINCH:
info = TimelineChartLabels.UIEVENT_GESTURE_PINCH
+ NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_CENTER
+ " X : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_X) + NEW_LINE
+ + log.getX() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_CENTER
+ " Y : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_Y) + NEW_LINE
+ + log.getY() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DISTANCE + " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO1);
+ + log.getInfo1();
break;
case GESTURE_TYPE_ROTATION:
info = TimelineChartLabels.UIEVENT_GESTURE_ROTATION + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_DISTANCE
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO1)
- + TimelineChartLabels.UIEVENT_INFO_ANGLE + " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO2);
+ + log.getInfo1() + TimelineChartLabels.UIEVENT_INFO_ANGLE
+ + " : "//$NON-NLS-1$
+ + log.getInfo2();
break;
case GESTURE_TYPE_TAP:
info = TimelineChartLabels.UIEVENT_GESTURE_TAP
+ " "//$NON-NLS-1$
+ TimelineChartLabels.UIEVENT_INFO_COUNT
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_Y)
+ + log.getY()
+ NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_X) + NEW_LINE
+ + log.getX() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_TAP_INTERVAL
+ " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO1) + NEW_LINE
+ + log.getInfo1() + NEW_LINE
+ TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$
- + log.get(LogCenterConstants.UI_EVENT_INFO2);
+ + log.getInfo2();
break;
default:
System.out.println("UIEventChart.java wrong gesture type");//$NON-NLS-1$
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
private ArrayList<DAChartSeries> tempSeriesList;
private boolean[] usedColor;
- public UserCustomChart(int chartType, String chartName) {
+ public UserCustomChart(long chartType, String chartName) {
this.chartType = chartType;
this.chartName = chartName;
chartIcon = ImageResources.CHART_CUSTOM;
@Override
public void parseLogPackage(LogPackage logPack) {
- Logs logList = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
- List<List<String>> logs = logList.getLogs();
+ Logs logList = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM);
+ List<LogData> logs = logList.getLogs();
if (logs.size() <= 0) {
return;
parsingLog(logs.get(logs.size() - 1));
}
- private void parsingLog(List<String> log) {
+ private void parsingLog(LogData log) {
try {
- double time = Double.parseDouble(log
- .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ double time = Double.parseDouble(Long.toString(log.getTime()))
/ TimelineConstants.MEGA;
chart.getPlot().setValidEndX(time);
} catch (NumberFormatException ne) {
private List<TimelineChart> chartList;
private ArrayList<TimelineChart> newChartList;
private List<TimelineChart> selectedChartList;
- private HashMap<Integer, UserCustomChart> customChartMap;
+ private HashMap<Long, UserCustomChart> customChartMap;
private DAChartBoard chartBoard = null;
public static TimelineChartManager getInstance() {
chartList = new ArrayList<TimelineChart>();
newChartList = new ArrayList<TimelineChart>();
selectedChartList = new ArrayList<TimelineChart>();
- customChartMap = new HashMap<Integer, UserCustomChart>();
+ customChartMap = new HashMap<Long, UserCustomChart>();
loadSavedChartList();
loadSelectedChartList();
}
public void addCustomChart(UserCustomChart customChart) {
- int chartType = customChart.getChartType();
+ long chartType = customChart.getChartType();
if (!customChartMap.containsKey(chartType)) {
customChartMap.put(chartType, customChart);
chartList.add(customChart);
public class TimelineConstants {
/* timeline Item type */
public static final int NOT_DEFAULT_CHART = -100;
- public static final int CHART_TYPE_CPU = -101;
+ public static final int CHART_TYPE_CPU = -101;
public static final int CHART_TYPE_CPU_CORE = -102;
public static final int CHART_TYPE_CPU_FREQUENCY = -103;
public static final int CHART_TYPE_HEAP = -104;
public static final int CHART_TYPE_FILE = -107;
public static final int CHART_TYPE_SCREENSHOT = -108;
public static final int CHART_TYPE_UIEVENT = -109;
-
+
/* range selector */
public static final int TIMELINE_ITEM_INFO_WIDTH = 99;
public static final double MEGA = 1000000;
-
+
public static final int NOT_INITED = -1;
}
private int SwapItemIndexB = 0;
private int ChangeDragItemIndex = 0;
- private final String strEnableChart = "selected enable"; //$NON-NLS-1$
- private final String strDisableChart = "selected disable"; //$NON-NLS-1$
+ private static final String strEnableChart = "selected enable"; //$NON-NLS-1$
+ private static final String strDisableChart = "selected disable"; //$NON-NLS-1$
private static boolean RunningDialog = false;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.model.SnapshotData;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
long start = selData.getStartTime();
long end = selData.getEndTime();
- double startTime = (double) start / TimelineConstants.MEGA;
- double endTime = (double) end / TimelineConstants.MEGA;
+ Double startTime = (double) start / TimelineConstants.MEGA;
+ Double endTime = (double) end / TimelineConstants.MEGA;
double middleTime = (startTime + endTime) / 2.0;
- if (endTime == startTime) {
+ if (startTime.equals(endTime)) {
middleTime = startTime;
}
@Override
public void updateView() {
+ if (ToolbarArea.getInstance() == null) {
+ System.out.println("toolbar area is null");//$NON-NLS-1$
+ return;
+ }
+
timelineChartManager.addNewCustomChart();
chartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
return;
}
- Logs deviceLogs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+ Logs deviceLogs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM);
if (deviceLogs != null && deviceLogs.getLogs() != null
- && deviceLogs.getLogs().size() > 0) {
+ && !deviceLogs.getLogs().isEmpty()) {
deviceLogParser.parseLogPackage(logPack);
}
- Logs recorderLogs = logPack.getLogs(LogCenterConstants.LOG_RECODER);
+ Logs recorderLogs = logPack
+ .getLogs(AnalyzerConstants.MSG_PROBE_UIEVENT);
if (recorderLogs != null && recorderLogs.getLogs() != null
- && recorderLogs.getLogs().size() > 0) {
+ && !recorderLogs.getLogs().isEmpty()) {
UIEventChart.getInstance().parseLogPackage(logPack);
}
- Logs customLogs = logPack.getLogs(LogCenterConstants.LOG_CUSTOM_CHART);
+ Logs customLogs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_CUSTOM);
if (customLogs != null && customLogs.getLogs() != null
- && customLogs.getLogs().size() > 0) {
+ && !customLogs.getLogs().isEmpty()) {
customLogParser.parseLogPackage(logPack);
}
- Logs lifecycleLogs = logPack.getLogs(LogCenterConstants.LOG_LIFECYCLE);
+ Logs lifecycleLogs = logPack
+ .getLogs(AnalyzerConstants.MSG_PROBE_LIFECYCLE);
if (lifecycleLogs != null && lifecycleLogs.getLogs() != null
- && lifecycleLogs.getLogs().size() > 0) {
+ && !lifecycleLogs.getLogs().isEmpty()) {
lifecycleLogParser.parseLogPackage(logPack);
}
Logs screenShotLogs = logPack
- .getLogs(LogCenterConstants.LOG_SCREENSHOT);
+ .getLogs(AnalyzerConstants.MSG_PROBE_SCREENSHOT);
if (screenShotLogs != null && screenShotLogs.getLogs() != null
- && screenShotLogs.getLogs().size() > 0) {
+ && !screenShotLogs.getLogs().isEmpty()) {
ScreenshotChart.getInstance().parseLogPackage(logPack);
}
}
import java.util.Map;
import org.eclipse.swt.graphics.Color;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.CustomData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
public class CustomLogParser {
- private final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
- private final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$
- private final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$
- private final String API_NAME_DA_LOG= "da_log"; //$NON-NLS-1$
-// private final String API_NAME_DA_MARK = "da_mark"; //$NON-NLS-1$
- private final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$
-
- private final int CUSTOM_COLOR_AUTO = 0;
- private final int CUSTOM_COLOR_BLUE = 1;
- private final int CUSTOM_COLOR_GREEN = 2;
- private final int CUSTOM_COLOR_RED = 3;
- private final int CUSTOM_COLOR_BROWN = 4;
- private final int CUSTOM_COLOR_PURPLE = 5;
- private final int CUSTOM_COLOR_NAVY = 6;
- private final int CUSTOM_COLOR_CHOCOLATE = 7;
- private final int CUSTOM_COLOR_INDIGO = 8;
- private final int CUSTOM_COLOR_MAGNETA = 9;
- private final int CUSTOM_COLOR_TEAL = 10;
-
-
- private TimelineChartManager chartManager = TimelineChartManager.getInstance();
- private Map<Integer, DAChartSeries> customChartSeriesMap = new HashMap<Integer, DAChartSeries>();
-
+ private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
+ private static final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$
+ private static final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$
+ private static final String API_NAME_DA_LOG = "da_log"; //$NON-NLS-1$
+ private static final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$
+
+ private static final int CUSTOM_COLOR_AUTO = 0;
+ private static final int CUSTOM_COLOR_BLUE = 1;
+ private static final int CUSTOM_COLOR_GREEN = 2;
+ private static final int CUSTOM_COLOR_RED = 3;
+ private static final int CUSTOM_COLOR_BROWN = 4;
+ private static final int CUSTOM_COLOR_PURPLE = 5;
+ private static final int CUSTOM_COLOR_NAVY = 6;
+ private static final int CUSTOM_COLOR_CHOCOLATE = 7;
+ private static final int CUSTOM_COLOR_INDIGO = 8;
+ private static final int CUSTOM_COLOR_MAGNETA = 9;
+ private static final int CUSTOM_COLOR_TEAL = 10;
+
+ private TimelineChartManager chartManager = TimelineChartManager
+ .getInstance();
+ private Map<Long, DAChartSeries> customChartSeriesMap = new HashMap<Long, DAChartSeries>();
+
public void parseLogPackage(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_CUSTOM_CHART);
- List<List<String>> logList = logs.getLogs();
-
- for(List<String> log : logList) {
- parsingLog(log);
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_CUSTOM);
+ List<LogData> logList = logs.getLogs();
+
+ for (LogData log : logList) {
+ parsingLog((CustomData) log);
}
}
-
- private void parsingLog(List<String> log) {
- String apiName = log.get(LogCenterConstants.APINAME_INDEX);
-
- if(apiName.equals(API_NAME_CREATE_CHART)) {
- int chartHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
- String chartName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
- chartManager.addCustomChart(new UserCustomChart(chartHandle, chartName));
- } else if(apiName.equals(API_NAME_CREATE_SERIES)) {
- int chartType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- UserCustomChart chart = (UserCustomChart)chartManager.getChartInstance(chartType);
- if(chart == null) {
- System.out.println("CustomLogParser.java : unrecognized chart handle"); //$NON-NLS-1$
+
+ private void parsingLog(CustomData log) {
+ String apiName = log.getApiName();
+
+ if (apiName.equals(API_NAME_CREATE_CHART)) {
+ long chartHandle = log.getReturn();
+ String chartName = log.getName();
+ chartManager.addCustomChart(new UserCustomChart(chartHandle,
+ chartName));
+ } else if (apiName.equals(API_NAME_CREATE_SERIES)) {
+ int chartType = log.getHandle();
+ UserCustomChart chart = (UserCustomChart) chartManager
+ .getChartInstance(chartType);
+ if (chart == null) {
+ System.out
+ .println("CustomLogParser.java : unrecognized chart handle"); //$NON-NLS-1$
return;
}
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
- int seriesStyle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_TYPE));
- String seriesName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
- int colorIndex = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_COLOR));
- if(colorIndex == CUSTOM_COLOR_AUTO) {
+ long seriesHandle = log.getReturn();
+ int seriesStyle = log.getType();
+ String seriesName = log.getName();
+ int colorIndex = log.getColor();
+ if (colorIndex == CUSTOM_COLOR_AUTO) {
colorIndex = chart.getUnusedColorIndex();
}
Color seriesColor = getCustomColor(colorIndex);
- if(seriesColor == null) {
- System.out.println("CustomLogParser.java : undefined custom color"); //$NON-NLS-1$
+ if (seriesColor == null) {
+ System.out
+ .println("CustomLogParser.java : undefined custom color"); //$NON-NLS-1$
return;
}
-
- DAChartSeries series = new DAChartSeries(seriesName, seriesStyle, seriesColor);
+
+ DAChartSeries series = new DAChartSeries(seriesName, seriesStyle,
+ seriesColor);
chart.addTempSeries(series, colorIndex);
customChartSeriesMap.put(seriesHandle, series);
- } else if(apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) {
- int chartType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- UserCustomChart chart = (UserCustomChart)chartManager.getChartInstance(chartType);
- if(chart == null) {
+ } else if (apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) {
+ int chartType = log.getType();
+ UserCustomChart chart = (UserCustomChart) chartManager
+ .getChartInstance(chartType);
+ if (chart == null) {
System.out.println("unrecognized chart handle"); //$NON-NLS-1$
return;
}
-
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
+
+ long seriesHandle = log.getReturn();
int colorIndex = chart.getUnusedColorIndex();
- String seriesName = log.get(LogCenterConstants.CUSTOM_CHART_TEXT);
-
- DAChartSeries series = new DAChartSeries(seriesName, DAChartSeries.SERIES_STYLE_LINE, getCustomColor(colorIndex));
+ String seriesName = log.getName();
+
+ DAChartSeries series = new DAChartSeries(seriesName,
+ DAChartSeries.SERIES_STYLE_LINE, getCustomColor(colorIndex));
chart.addTempSeries(series, colorIndex);
customChartSeriesMap.put(seriesHandle, series);
- } else if(apiName.equals(API_NAME_DA_LOG) || apiName.equals(API_NAME_TIMER_THREAD)) {
- int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_CHART_HANDLE));
- double time = Double.parseDouble(log.get(LogCenterConstants.TIME_INDEX))
+ } else if (apiName.equals(API_NAME_DA_LOG)
+ || apiName.equals(API_NAME_TIMER_THREAD)) {
+ long seriesHandle = log.getHandle();
+ double time = Double.parseDouble(Long.toString(log.getTime()))
/ TimelineConstants.MEGA;
- double value = Double.parseDouble(log.get(LogCenterConstants.CUSTOM_CHART_VALUE));
+ double value = log.getValue();
DAChartSeries series = customChartSeriesMap.get(seriesHandle);
- series.addSeriesItem(new DAChartSeriesItem(time, value, String.valueOf(value)));
- }
+ series.addSeriesItem(new DAChartSeriesItem(time, value, String
+ .valueOf(value)));
+ }
}
-
+
public void clear() {
customChartSeriesMap.clear();
}
-
+
private Color getCustomColor(int colorType) {
- switch(colorType) {
+ switch (colorType) {
case CUSTOM_COLOR_BLUE:
return ColorResources.BLUE;
case CUSTOM_COLOR_GREEN:
import java.util.List;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
public class DeviceLogParser {
public void parseLogPackage(LogPackage logPack) {
- Logs deviceLogs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+ Logs deviceLogs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM);
if (deviceLogs != null && deviceLogs.getLogs() != null
&& deviceLogs.getLogs().size() > 0) {
List<TimelineChart> chartList = TimelineChartManager.getInstance()
.getChartList();
for (TimelineChart chart : chartList) {
- if (chart.getProbeType() == LogCenterConstants.LOG_DEVICE) {
+ if (chart.getProbeType() == AnalyzerConstants.MSG_DATA_SYSTEM) {
chart.parseLogPackage(logPack);
}
}
import java.util.List;
import org.eclipse.swt.graphics.Color;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LifeCycleData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleBar;
public class LifecycleLogParser {
private static LifecycleLogParser instance = null;
- private final String API_NAME_INITIALIZING = "INITIALIZING";//$NON-NLS-1$
- private final String API_NAME_RUNNING = "RUNNING";//$NON-NLS-1$
- private final String API_NAME_PAUSING = "PAUSING";//$NON-NLS-1$
- private final String API_NAME_TERMINATING = "TERMINATING";//$NON-NLS-1$
+ private static final String API_NAME_INITIALIZING = "INITIALIZING";//$NON-NLS-1$
+ private static final String API_NAME_RUNNING = "RUNNING";//$NON-NLS-1$
+ private static final String API_NAME_PAUSING = "PAUSING";//$NON-NLS-1$
+ private static final String API_NAME_TERMINATING = "TERMINATING";//$NON-NLS-1$
private List<LifecycleBar> lifecycleBarList = new ArrayList<LifecycleBar>();
private List<DATimeline> timelineList = new ArrayList<DATimeline>();
}
public void parseLogPackage(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_LIFECYCLE);
- List<List<String>> logList = logs.getLogs();
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_LIFECYCLE);
+ if (null == logs) {
+ return;
+ }
+ List<LogData> logList = logs.getLogs();
- for (List<String> log : logList) {
- parsingLog(log);
+ for (LogData log : logList) {
+ parsingLog((LifeCycleData) log);
}
}
- private void parsingLog(List<String> log) {
- String apiName = log.get(LogCenterConstants.APINAME_INDEX);
+ private void parsingLog(LifeCycleData log) {
+ String apiName = log.getApiName();
Color colorTop;
Color colorBottom;
String text;
return;
}
- double startTime = Double.parseDouble(log
- .get(LogCenterConstants.TIME_INDEX)) / TimelineConstants.MEGA;
+ double startTime = Double.parseDouble(Long.toString(log.getTime()))
+ / TimelineConstants.MEGA;
LifecycleData lifecycleData = new LifecycleData(startTime, colorTop,
colorBottom, text);
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
private Shell shell;
private Shell parent;
private UIEventListTable uiEventListTable;
- private List<DAChartSeriesItem> seriesItemList;
- private String eventType;
+ private List<DAChartSeries> chartSeriesList;
+ private List<Integer> startIndexList;
+ private List<Integer> endIndexList;
- private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_NAME,
+ private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_TYPE,
+ TimelinePageLabels.UI_EVENT_LIST_NAME,
TimelinePageLabels.UI_EVENT_LIST_TIME,
TimelinePageLabels.UI_EVENT_LIST_SET_RANGE };
- private int[] columnSizes = { 180, 112, 140 };
- private boolean[] columnVisibility = { true, true, true };
+ private int[] columnSizes = { 74, 102, 100, 140 };
+ private boolean[] columnVisibility = { true, true, true, true };
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID,
+ AnalyzerConstants.SORT_TYPE_GRID, AnalyzerConstants.SORT_TYPE_GRID,
+ AnalyzerConstants.SORT_TYPE_NONE };
+ DefaultTableComparator comparator = new DefaultTableComparator();
public UIEventListDialog(Shell parent) {
super(parent);
public int open() {
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- shell.setText(eventType + " event list");
+ shell.setText("Event list"); // FIXME
shell.setSize(446, 450);
shell.setLayout(new FormLayout());
uiEventListTable.setColumns(columnNames);
uiEventListTable.setColumnSize(columnSizes);
uiEventListTable.setColumnVisibility(columnVisibility);
+ uiEventListTable.setSortTypes(sortTypes);
+ comparator.setColumn(2);
+ uiEventListTable.setComparator(comparator);
uiEventListTable.getTable().setData(UIEventListDialog.KEY_START_TIME,
-1.0);
uiEventListTable.getTable().setData(UIEventListDialog.KEY_END_TIME,
return 0;
}
- public void setSeriesItemInfo(DAChartSeries series, int fromIndex,
- int toIndex) {
- seriesItemList = series.getSeriesItemList().subList(fromIndex, toIndex);
- eventType = series.getName();
+ public void setSelectedEventInfo(List<DAChartSeries> chartSeriesList,
+ List<Integer> startIndexList, List<Integer> endIndexList) {
+ this.chartSeriesList = chartSeriesList;
+ this.startIndexList = startIndexList;
+ this.endIndexList = endIndexList;
}
private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
DAChartBoard chartBoard = (DAChartBoard) AnalyzerManager
.getCurrentPage().getView(TimelineView.ID).getControl();
- double startTime = (Double) uiEventListTable.getTable().getData(
+ Double startTime = (Double) uiEventListTable.getTable().getData(
KEY_START_TIME);
- double endTime = (Double) uiEventListTable.getTable().getData(
+ Double endTime = (Double) uiEventListTable.getTable().getData(
KEY_END_TIME);
+ if (startTime == null || endTime == null) {
+ return;
+ }
+
if (startTime != -1 && endTime != -1 && startTime > endTime) {
double temp = startTime;
startTime = endTime;
@Override
protected List<TableInput> makeTableInput() {
List<TableInput> inputList = new ArrayList<TableInput>();
- for (DAChartSeriesItem item : seriesItemList) {
- List<String> columnTexts = new ArrayList<String>();
- columnTexts.add(item.getTooltipText().split("\n")[0]);//$NON-NLS-1$
- columnTexts.add(String.valueOf(item.getX()));
-
- TableInput tableInput = new TableInput();
- tableInput.setText(columnTexts);
- DATableDataFormat dataFormat = new DATableDataFormat(null);
- dataFormat.setObject(item.getX());
- tableInput.setData(dataFormat);
-
- inputList.add(tableInput);
+
+ for (int i = 0; i < chartSeriesList.size(); i++) {
+ String seriesName = chartSeriesList.get(i).getName();
+ int fromIndex = startIndexList.get(i);
+ int toIndex = endIndexList.get(i);
+
+ if (fromIndex > toIndex || fromIndex == -1 || toIndex == -1) {
+ continue;
+ }
+
+ List<DAChartSeriesItem> subItemList = chartSeriesList.get(i)
+ .getSeriesItemList().subList(fromIndex, toIndex);
+
+ for (DAChartSeriesItem item : subItemList) {
+ List<String> columnTexts = new ArrayList<String>();
+ columnTexts.add(seriesName);
+ columnTexts.add(item.getTooltipText().split("\n")[0]);//$NON-NLS-1$
+ columnTexts.add(String.valueOf(item.getX()));
+
+ TableInput tableInput = new TableInput();
+ tableInput.setText(columnTexts);
+ DATableDataFormat dataFormat = new DATableDataFormat(0);
+ dataFormat.setObject(item.getX());
+ tableInput.setData(dataFormat);
+
+ inputList.add(tableInput);
+ }
}
return inputList;
private int textTopMargin = 1;
private int insideMargin = 3;
- private int CHECK_INDEX = 2;
+ private int CHECK_INDEX = 3;
private final int buttonWidth = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL
.getBounds().width;
true);
}
if (item.getParent().getLinesVisible()) {
- if (isCellSelected()) {
- gc.setForeground(ColorResources.TABLE_LINE);
- } else {
- gc.setForeground(ColorResources.TABLE_LINE);
- }
+ gc.setForeground(ColorResources.TABLE_LINE);
gc.drawLine(getBounds().x, getBounds().y + getBounds().height,
getBounds().x + getBounds().width - 1, getBounds().y
+ getBounds().height);
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
ShortCutManager.getInstance().setEnabled(!opened);
shell.open();
- Display display = PlatformUI.createDisplay();
+ Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
SDKAboutFile = new File(AnalyzerPaths.ABOUT_FILE_PATH);
}
- BufferedReader in;
+ BufferedReader in = null;
String content;
try {
in = new BufferedReader(new FileReader(SDKAboutFile));
while (null != (content = in.readLine())) {
buildTime = parseBuildTime(content);
if (buildTime != null) {
+ AnalyzerUtil.tryClose(in);
return buildTime;
}
}
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(in);
}
return null;
SDKAboutFile = new File(AnalyzerPaths.ABOUT_FILE_PATH);
}
- BufferedReader in;
+ BufferedReader in = null;
String content;
try {
in = new BufferedReader(new FileReader(SDKAboutFile));
while (null != (content = in.readLine())) {
version = parseVersion(content);
if (version != null) {
+ AnalyzerUtil.tryClose(in);
return version;
}
}
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(in);
}
return null;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class ConfigureManager {
e.printStackTrace();
}
} else {
- BufferedReader in;
+ BufferedReader in = null;
String content;
try {
in = new BufferedReader(new FileReader(configFile));
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(in);
}
+
}
setCheckDefaultConfigData();
setConfigDataToFile();
}
File configFile = new File(configFilePath);
- FileWriter fileWriter;
- BufferedWriter buffWriter;
- PrintWriter printWriter;
+ FileWriter fileWriter = null;
+ BufferedWriter buffWriter = null;
+ PrintWriter printWriter = null;
try {
fileWriter = new FileWriter(configFile);
buffWriter = new BufferedWriter(fileWriter);
}
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(fileWriter, buffWriter, printWriter);
}
}
}
}
}
+
+ public int getConfiguration() {
+ int state = 0;
+
+ state |= getValueInt(ConfigureLabels.FUNCTIONPROFILING);
+ state |= getValueInt(ConfigureLabels.ALLOCATION);
+ state |= getValueInt(ConfigureLabels.FILE);
+ state |= getValueInt(ConfigureLabels.THREAD);
+ state |= getValueInt(ConfigureLabels.USERINTERFACE);
+ state |= getValueInt(ConfigureLabels.SNAPSHOT);
+ state |= getValueInt(ConfigureLabels.EVENT);
+ state |= getValueInt(ConfigureLabels.RECORDING);
+
+ return state;
+ }
}
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
if (!configFile.isFile()) {
return AnalyzerLabels.LICENSE_DIALOG_NOT_FOUND;
} else {
- BufferedReader in;
+ BufferedReader in = null;
String content;
try {
in = new BufferedReader(new FileReader(configFile));
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ AnalyzerUtil.tryClose(in);
}
}
return ret.toString();
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
-import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
-import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
-import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
-import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class RecordStartStopThread implements Runnable {
private static Thread startStopThread = null;
@Override
public void run() {
if (AnalyzerManager.isRunning()) {
- boolean isStarted = recordStart();
- if (isStarted) {
+ HostResult isStarted = recordStart();
+ if (isStarted.isSuccess()) {
if (ReplayTraceHandler.isReplay) {
ReplayTraceHandler.setStopAlarm();
}
} else {
AnalyzerUtil
.setRecordState(RecordStateSourceProvider.RECORD_READY);
+ final String msg = isStarted.toString();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
.getShell();
DADialog dialog = new DADialog(shell, SWT.NONE);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
- dialog.setMessage(AnalyzerLabels.START_TRACE_ERROR);
+ // dialog.setMessage(AnalyzerLabels.START_TRACE_ERROR);
+ dialog.setMessage(msg);
dialog.open();
ToolbarArea.getInstance().setToolbarState(
count--;
}
- private boolean recordStart() {
-
+ private HostResult recordStart() {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
AnalyzerManager.initRecordStart();
- if (!DACommunicator.connectionProcess()) {
- System.out.println("failed to connect the device.");//$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- ToolbarArea.getInstance().setStartButtonEnablement(true);
- ToolbarArea.getInstance().setSettingsButtonEnablement(true);
- // ToolbarArea.getInstance().setSnapshotButtonEnablement(true);
- }
- });
- return false;
- }
- if (!AnalyzerManager.isExit()) {
- if (!DACommunicator.sendStartMessage()) {
- DACommunicator.setRunning(false);
- return false;
- }
- UIRecorderTool.getInstance().startRecorder();
- ToolbarArea.getInstance().startTimer();
- LogParser.startLogParser();
- FileChartManager.getInstance().startUpdateLogThread();
- ThreadChartManager.getInstance().startUpdateLogThread();
- UIDataManager.getInstance().startUpdateLogThread();
- FunctionUsageProfiler.startProfiler();
-
- /* Timeline */
- UpdateViewTimer.start();
- System.out
- .println("Start recorder, timer, log parser, file, thread, ui, profile , update timer");
- return true;
- }
-
- return false;
+ return HostResult.printAndReturn(DACommunicator.startTrace());
}
private void recordStop() {
}
});
- DACommunicator.sendStopMessage();
+ // DACommunicator.sendStopMessage();
+ DACommunicator.stopTrace();
}
}
DADialog dialog = new DADialog(shell, SWT.NONE); // FIXME
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage(AnalyzerLabels.OS_WARNING);
- if (dialog.open() == true) {
- System.exit(-1);
- }
+ dialog.open();
+ return null;
}
+ if (null == splitSourcePath) {
+ return null;
+ }
String saveFileName = new String(
splitSourcePath[splitSourcePath.length - 1]);
if (null == saveFileName || saveFileName.isEmpty()) {
} else {
project.setLastTime(ToolbarArea.getInstance().getTime());
SqlManager.getInstance().insertProject();
+ SqlManager.getInstance().insertTargetInfo();
+ SqlManager.getInstance().insertProcessInfo();
SqlManager.getInstance().saveLeakData();
SqlManager.getInstance().saveFailedData();
SqlManager.getInstance().saveCallStackData();
SqlManager.getInstance().saveCallStackUnits();
- SqlManager.getInstance().saveAppInfo();
SqlManager.getInstance().saveProfilingData();
SqlManager.getInstance().saveProfilingChildData();
+ SqlManager.getInstance().saveApiNames();
System.out.println("insert to db complete..."); //$NON-NLS-1$
percent += 10;
return instance;
}
- public void stopProcessStart(String endMessage) {
+ public void stopProcessStart(String EndMessage) {
if (state == STOP_PROCESS_START || state == STOP_PROCESS_END) {
return;
}
dialog = new ProgressDialog(shell, SWT.APPLICATION_MODAL);
if (null != dialog) {
dialog.open();
- dialog.setProgressMessage(endMessage);
+ dialog.setProgressMessage(EndMessage);
dialog.setProgressInfo(AnalyzerLabels.STOP_PROCESS_DLG_PLEASE_WAIT);
}
}
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.swap.communicator.Communicator30;
+import org.tizen.dynamicanalyzer.swap.logparser.MessageParser;
+import org.tizen.dynamicanalyzer.swap.model.data.TestProbe;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
}
});
+ deviceCombo.addListener(SWT.MouseDown, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ DACommunicator.checkDevices();
+ }
+ });
+
appCombo.addSelectionListener(new DACustomComboSelectionListener() {
@Override
public void handleEvent(Event event) {
if (!appCombo.isChildShellOpened()) {
List<AppInfo> apps = DACommunicator.getAppListFromTarget();
- if (apps.isEmpty()) {
+ if (null == apps || apps.isEmpty()) {
return;
}
String selectedApp = appCombo.getText();
public void handleClickEvent(DACustomButton button) {
// TODO : use for test code...
+
+ TestProbe test = new TestProbe();
+
+ byte[] input = test.getByteValue();
+ MessageParser.getInstance().testParsing(input);
+
+ Communicator30 c30 = new Communicator30();
+ c30.startTrace();
+
+ c30.sendRuntimeMessage(0, "test");
+ c30.stopTrace();
// DACommunicator.getLocalhost();
// System.out.println(CommonConstants.LOCAL_HOST);
// AnalyzerLabels.COOLBAR_AREA_FILE);
}
});
-
- snapshotButton.addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- if (snapshotButton.isToggled()) {
- DACommunicator
- .sendSnapshotMessage(AnalyzerConstants.SNAPSHOT_ON);
- ConfigureManager.getInstance().setValue(
- ConfigureLabels.SNAPSHOT, CommonConstants.ON);
- } else {
- DACommunicator
- .sendSnapshotMessage(AnalyzerConstants.OPT_OFF);
- DACommunicator
- .sendSnapshotMessage(AnalyzerConstants.SNAPSHOT_OFF);
- ConfigureManager.getInstance().setValue(
- ConfigureLabels.SNAPSHOT, CommonConstants.OFF);
- }
- }
- });
}
public void setStartButtonToolTipText(final String text) {
public void startTrace() {
ShortCutManager.getInstance().setEnabled(false);
Display.getDefault().syncExec(new Runnable() {
+
@Override
public void run() {
StartProcessManager.getInstance().startProcessStart(
- "Prepare trace");
+ "prepare for tracing");
}
});
+
if (!checkValidApplication()) {
// fail message box
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
settingsButton = new DACustomButton(parent, ImageResources.SETTINGS,
ImageResources.SETTINGS_PUSH, ImageResources.SETTINGS_HOVER,
ImageResources.SETTINGS_DISABLE);
- settingsButton.setToolTipText(AnalyzerLabels.SETTING);
+ settingsButton.setToolTipText(ShortCutManager.COOLBAR_AREA_SETTING);
buttons.put(SETTING_BUTTON, settingsButton);
// Creates about button.
aboutButton = new DACustomButton(parent, ImageResources.ABOUT,
ImageResources.ABOUT_PUSH, ImageResources.ABOUT_HOVER,
ImageResources.ABOUT_DISABLE);
- aboutButton.setToolTipText(AnalyzerLabels.ABOUT);
+ aboutButton.setToolTipText(ShortCutManager.COOLBAR_AREA_ABOUT);
buttons.put(ABOUT_BUTTON, aboutButton);
// Creates view source button.
ImageResources.VIEW_SOURCE_TOGGLE,
ImageResources.VIEW_SOURCE_TOGGLE_HOVER,
ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
- viewSourceButton.setToolTipText(AnalyzerLabels.VIEW_SOURCE);
+ viewSourceButton
+ .setToolTipText(ShortCutManager.COOLBAR_AREA_VIEW_SOURCE);
buttons.put(SOURCE_BUTTON, viewSourceButton);
// Creates snapshot on/off button.
return;
}
appCombo.setEnabled(true);
+ appCombo.initCombo();
+
List<AppInfo> apps = DACommunicator.getAppListFromTarget();
+ int size = 0;
+ if (null != apps) {
+ size = apps.size();
+ }
- appCombo.initCombo();
- int size = apps.size();
for (int i = 0; i < size; i++) {
appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
apps.get(0).getInfo(AppInfo.LABEL_INDEX));
} else {
AppInfo appInfo = DACommunicator.getPkgInfoByName(appName);
- appCombo.setText(appName);
- setSelectedApp(appInfo);
- DACommunicator.setSelectedApp(appInfo);
- DACommunicator.getSelectedDevice().setSelectedAppName(
- appInfo.getInfo(AppInfo.LABEL_INDEX));
+ if (null != appInfo) {
+ appCombo.setText(appName);
+ setSelectedApp(appInfo);
+ DACommunicator.setSelectedApp(appInfo);
+ DACommunicator.getSelectedDevice().setSelectedAppName(
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
+ startButton.setButtonEnabled(true);
+ } else {
+ appCombo.setText(appName);
+ appCombo.select(0);
+ setSelectedApp(null);
+ DACommunicator.setSelectedApp(null);
+ }
}
- startButton.setButtonEnabled(true);
-
} else {
appCombo.add(CommonConstants.EMPTY);
appCombo.select(0);
setSelectedApp(null);
DACommunicator.setSelectedApp(null);
-
}
}
}
appCombo.select(COMBO_FIRST_INDEX);
AppInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0));
- DACommunicator.setSelectedApp(appInfo);
- DACommunicator.getSelectedDevice().setSelectedAppName(
- appInfo.getInfo(AppInfo.LABEL_INDEX));
- appCombo.setToolTipText(appCombo.getItem(0));
- startButton.setButtonEnabled(true);
+ if (null != appInfo) {
+ DACommunicator.setSelectedApp(appInfo);
+ DACommunicator.getSelectedDevice().setSelectedAppName(
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
+ appCombo.setToolTipText(appCombo.getItem(0));
+ startButton.setButtonEnabled(true);
+ } else {
+ appCombo.add(CommonConstants.EMPTY);
+ }
} else {
appCombo.add(CommonConstants.EMPTY);
}
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
-import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
private DACustomButton applyButton = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
- DAPageComposite topComposite = null;
DATabComposite tabView = null;
public ConfigurationDialog(Shell parent, int style) {
private void doApply() {
ConfigurationDialogValues.getInstance().applySettingValueToConfigFile();
- DACommunicator.sendSnapshotMessage(DACommunicator.getConfiguration());
+ DACommunicator.sendRuntimeMessage(DACommunicator.MSG_TYPE_CONFIG, null);
}
private void doBack() {
public class ConfigurationDialogFeaturesTable extends DATableComposite {
- private final String TRUE = "true"; //$NON-NLS-1$
- private final String FALSE = "false";//$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private static final String FALSE = "false";//$NON-NLS-1$
public ConfigurationDialogFeaturesTable(Composite parent, int style) {
super(parent, style);
DefaultCellRenderer {
int leftMargin = 4;
int rightMargin = 4;
- int topMargin = 0;
- int bottomMargin = 0;
+// int topMargin = 0;
+// int bottomMargin = 0;
int textTopMargin = 1;
- int textBottomMargin = 2;
+// int textBottomMargin = 2;
int insideMargin = 3;
public Image checkImg = null;
private static final String ON = ConfigureLabels.ON;
private static final String OFF = ConfigureLabels.OFF;
- String[] returnStr = null;
- String strPid = ConfigureManager.getInstance().getValue(
- ConfigureLabels.SINGLETON_FOCUS_DA_PID);
+// String[] returnStr = null;
+// String strPid = ConfigureManager.getInstance().getValue(
+// ConfigureLabels.SINGLETON_FOCUS_DA_PID);
public static ConfigurationDialogValues getInstance() {
if (null == instance) {
if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
if (isChangeFeatuesValues(getFunctionProfilingCall(),
featueName)) {
- System.out.println("change valuse FUNCTIONPROFILING");
+ System.out.println("change values FUNCTIONPROFILING");
}
} else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
if (isChangeFeatuesValues(getAllocationCall(), featueName)) {
- System.out.println("change valuse ALLOCATION");
+ System.out.println("change values ALLOCATION");
}
} else if (featueName.equals(ConfigureLabels.FILE)) {
if (isChangeFeatuesValues(getFileCall(), featueName)) {
- System.out.println("change valuse FILE");
+ System.out.println("change values FILE");
}
} else if (featueName.equals(ConfigureLabels.THREAD)) {
if (isChangeFeatuesValues(getThreadCall(), featueName)) {
- System.out.println("change valuse THREAD");
+ System.out.println("change values THREAD");
}
} else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
if (isChangeFeatuesValues(getUserInterfaceCall(), featueName)) {
- System.out.println("change valuse USERINTERFACE");
+ System.out.println("change values USERINTERFACE");
}
} else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
if (isChangeFeatuesValues(getSnapshotCall(), featueName)) {
- System.out.println("change valuse SNAPSHOT");
+ System.out.println("change values SNAPSHOT");
}
} else if (featueName.equals(ConfigureLabels.EVENT)) {
if (isChangeFeatuesValues(getEventCall(), featueName)) {
- System.out.println("change valuse EVENT");
+ System.out.println("change values EVENT");
}
} else if (featueName.equals(ConfigureLabels.RECORDING)) {
if (isChangeFeatuesValues(isbRecordingCall(), featueName)) {
- System.out.println("change valuse RECORDING");
+ System.out.println("change values RECORDING");
}
} else {
System.out.println("failed undefine features");
}
// Setting
if (isChangeFeatuesValues(isShowInitia(), ConfigureLabels.SHOW_INITIAL)) {
- System.out.println("change valuse SHOW_INITIAL");
+ System.out.println("change values SHOW_INITIAL");
}
if (isChangeFeatuesValues(isAutoStop(), ConfigureLabels.AUTO_STOP)) {
- System.out.println("change valuse AUTO_STOP");
+ System.out.println("change values AUTO_STOP");
}
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
private Shell window = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
- DAPageComposite topComposite = null;
private DACheckBox useAgainCheckButton = null;
private boolean returnType = true;
.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
FormData compData = new FormData();
- compData = new FormData();
compData.top = new FormAttachment(banner, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.logparser.LogParser;
-import org.tizen.dynamicanalyzer.logparser.Logs;
-import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public static void stopOpenTraceInputReader() {
if (null != openTraceInputThread && openTraceInputThread.isAlive()) {
try {
- openTraceInputThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ openTraceInputThread
+ .join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
public void run() {
LogParser.setLogParsingComplete(false);
Project p = AnalyzerManager.getProject();
- long last = p.getLastLogNum(LogCenterConstants.LOG_RESOURCE);
- createPackage(last, LogCenterConstants.LOG_RESOURCE);
+ long last = p.getLastLogNum(AnalyzerConstants.MSG_PROBE_FILE);
+ createPackage(last, AnalyzerConstants.MSG_PROBE_FILE);
- last = p.getLastLogNum(LogCenterConstants.LOG_DEVICE);
- createPackage(last, LogCenterConstants.LOG_DEVICE);
+ last = p.getLastLogNum(AnalyzerConstants.MSG_DATA_SYSTEM);
+ createPackage(last, AnalyzerConstants.MSG_DATA_SYSTEM);
- last = p.getLastLogNum(LogCenterConstants.LOG_PROFILING);
- createPackage(last, LogCenterConstants.LOG_PROFILING);
+ last = p.getLastLogNum(AnalyzerConstants.MSG_DATA_SAMPLE);
+ createPackage(last, AnalyzerConstants.MSG_DATA_SAMPLE);
System.out.println("input reader complete"); //$NON-NLS-1$
LogParser.setLogParsingComplete(true);
}
private void createPackage(long last, int type) {
- List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
- List<List<String>> input = null;
+ // List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
+ List<LogData> input = null;
LogPackage logPackage = new LogPackage();
long from = 0;
long to = AnalyzerConstants.DATABASE_READ_SIZE;
if (to >= last) {
to = last;
}
- if (type == LogCenterConstants.LOG_PROFILING
- || type == LogCenterConstants.LOG_DEVICE) {
+ if (type == AnalyzerConstants.MSG_DATA_SAMPLE
+ || type == AnalyzerConstants.MSG_DATA_SYSTEM) {
+ input = SqlManager.getInstance().selectArea(type, from, to);
Logs logs = new Logs(type);
- LogCenter logc = AnalyzerManager.getLogCenterById(type);
- input = SqlManager.getInstance().selectArea(logc, from, to);
logs.setLogs(input);
logPackage.setLogs(type, logs);
} else {
- int size = logCenters.size();
+ // int size = logCenters.size();
+ List<Integer> ids = LogDataFactory.getLogList();
+ int size = ids.size();
for (int i = 0; i < size; i++) {
- int id = logCenters.get(i).getId();
- if (id == LogCenterConstants.LOG_PROFILING
- || id == LogCenterConstants.LOG_DEVICE) {
+ int id = ids.get(i);
+ if (id == AnalyzerConstants.MSG_DATA_SAMPLE
+ || id == AnalyzerConstants.MSG_DATA_SYSTEM) {
continue;
}
Logs logs = new Logs(id);
- input = SqlManager.getInstance().selectArea(
- logCenters.get(i), from, to);
+ input = SqlManager.getInstance().selectArea(id, from, to);
logs.setLogs(input);
- logPackage.setLogs(logCenters.get(i).getId(), logs);
+ logPackage.setLogs(id, logs);
} // for
}
List<String> saveFileList = AnalyzerUtil
.getDirs(AnalyzerPaths.DYNAMIC_ANALYZER_SAVE_PATH);
List<TableInput> input = new ArrayList<TableInput>();
- int size = saveFileList.size();
- for (int i = 0; i < size; i++) {
- // create text
- List<String> text = new ArrayList<String>();
- if (!saveFileList.get(i).equals(AnalyzerConstants.TEMP_FOLDER_NAME)) {
- String path = AnalyzerPaths.DYNAMIC_ANALYZER_SAVE_PATH
- + File.separator + saveFileList.get(i);
- String inputText1 = saveFileList.get(i);
- String inputText2 = getCreateTime(path);
+ if (null != saveFileList) {
+ int size = saveFileList.size();
+ for (int i = 0; i < size; i++) {
+ // create text
+ List<String> text = new ArrayList<String>();
+ if (!saveFileList.get(i).equals(
+ AnalyzerConstants.TEMP_FOLDER_NAME)) {
+ String path = AnalyzerPaths.DYNAMIC_ANALYZER_SAVE_PATH
+ + File.separator + saveFileList.get(i);
+ String inputText1 = saveFileList.get(i);
+ String inputText2 = getCreateTime(path);
- if (inputText1.isEmpty() || null == inputText2
- || inputText2.isEmpty()) {
- continue;
- }
+ if (inputText1.isEmpty() || null == inputText2
+ || inputText2.isEmpty()) {
+ continue;
+ }
- text.add(inputText1);
- text.add(inputText2);
- if (isVaildVersion) {
- text.add("Y"); //$NON-NLS-1$
- } else {
- text.add("N"); //$NON-NLS-1$
+ text.add(inputText1);
+ text.add(inputText2);
+ if (isVaildVersion) {
+ text.add("Y"); //$NON-NLS-1$
+ } else {
+ text.add("N"); //$NON-NLS-1$
+ }
+ TableInput tableInput = new TableInput();
+ tableInput.setText(text);
+ input.add(tableInput);
}
- TableInput tableInput = new TableInput();
- tableInput.setText(text);
- input.add(tableInput);
}
}
return input;
List<String> tempFileList = AnalyzerUtil
.getDirs(AnalyzerPaths.TEMP_FOLDER_PATH);
List<TableInput> input = new ArrayList<TableInput>();
- int size = tempFileList.size();
- for (int i = 0; i < size; i++) {
- // create text
- List<String> text = new ArrayList<String>();
- if (!tempFileList.get(i).equals(AnalyzerConstants.TEMP_FOLDER_NAME)) {
- String path = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
- + tempFileList.get(i);
- text.add(tempFileList.get(i));
- text.add(getCreateTime(path));
- TableInput tableInput = new TableInput();
- tableInput.setText(text);
- input.add(tableInput);
+ if (null != tempFileList) {
+ int size = tempFileList.size();
+ for (int i = 0; i < size; i++) {
+ // create text
+ List<String> text = new ArrayList<String>();
+ if (!tempFileList.get(i).equals(
+ AnalyzerConstants.TEMP_FOLDER_NAME)) {
+ String path = AnalyzerPaths.TEMP_FOLDER_PATH
+ + File.separator + tempFileList.get(i);
+ text.add(tempFileList.get(i));
+ text.add(getCreateTime(path));
+ TableInput tableInput = new TableInput();
+ tableInput.setText(text);
+ input.add(tableInput);
+ }
}
}
return input;
List<String> pInfo = SqlManager.getInstance().getDetailsInfo(path);
if (null == pInfo || pInfo.isEmpty()) {
return null;
- }else{
+ } else {
return pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
}
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogListQueue;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ControlData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SceneData;
import org.tizen.dynamicanalyzer.ui.userinterface.control.UIControlListDataChecker;
import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingDataChecker;
import org.tizen.dynamicanalyzer.ui.userinterface.scene.UISceneDataChecker;
private static UIControlListDataChecker controlListDataChecker = null;
private static UISceneDataChecker sceneTransformDataChecker = null;
private static UIFunctionProfilingDataChecker functionProfilingDataChecker = null;
- private HashMap<String, String> findSnapshotViewHashMap = new HashMap<String, String>();
+ private HashMap<String, Long> findSnapshotViewHashMap = new HashMap<String, Long>();
private Thread updateLogThread = null;
private String strTableSeleteClassName = null;
private LogListQueue logListQueue = null;
- int testcode = 0;
-
public static UIDataManager getInstance() {
if (null == instance) {
instance = new UIDataManager();
public void run() {
LogListQueue logListQueue = getInstance().getLogListQueue();
while (!AnalyzerManager.isExit()) {
- List<List<String>> logs = logListQueue.getFirst();
+ List<LogData> logs = logListQueue.getFirst();
if (null == logs) {
break;
}
int size = logs.size();
for (int i = 0; i < size; i++) {
- String logType = logs.get(i).get(LogCenterConstants.ID_INDEX);
- int nLogType = Integer.parseInt(logType);
- if (nLogType == LogCenterConstants.LOG_CONTROL) {
- getInstance().getControlDataChecker()
- .parserLog(logs.get(i));
+ int nLogType = logs.get(i).getId();
+ if (nLogType == AnalyzerConstants.MSG_PROBE_UICONTROL) {
+ getInstance().getControlDataChecker().parserLog(
+ (ControlData) logs.get(i));
} else {
getInstance().getSceneTransformDataChecker().parserLog(
- logs.get(i));
+ (SceneData) logs.get(i));
}
}
}
}
public void setControlDataTFromLogPackage(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_CONTROL);
- if (null == logs || logs.getLogs().size() == 0) {
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_UICONTROL);
+ if (null == logs || logs.getLogs() == null
+ || logs.getLogs().size() == 0) {
return;
}
- List<List<String>> inputs = logs.getCloneLogs();
+ List<LogData> inputs = logs.getCloneLogs();
getLogListQueue().putLog(inputs);
}
public void setSceneTransformDataTFromLogPackage(LogPackage logPack) {
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_SCENE);
- if (null == logs || logs.getLogs().size() == 0) {
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_SCENE);
+ if (null == logs || logs.getLogs() == null
+ || logs.getLogs().size() == 0) {
return;
}
- List<List<String>> inputs = logs.getCloneLogs();
+ List<LogData> inputs = logs.getCloneLogs();
getLogListQueue().putLog(inputs);
}
}
}
- public HashMap<String, String> getFindSnapshotViewHashMap() {
+ public HashMap<String, Long> getFindSnapshotViewHashMap() {
return findSnapshotViewHashMap;
}
}
\ No newline at end of file
int topMargin = 0;
int bottomMargin = 0;
int textTopMargin = 1;
- int textBottomMargin = 2;
+// int textBottomMargin = 2;
int insideMargin = 3;
- int treeIndent = 20;
+// int treeIndent = 20;
private DATableToggleRenderer toggleRenderer;
private CheckBoxRenderer checkRenderer;
package org.tizen.dynamicanalyzer.ui.userinterface.control;
-import java.util.ArrayList;
-import java.util.List;
-
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public class UIControlListData {
public static final int KEY_INDEX = LogCenterConstants.SEQUENCE_NUMBER_INDEX;
public static final int USER_INTERFACE_CONTROL_LIST_DATABLEDATAFORMAT_CLASSNAME_INDEX = 20;
private String strCalssKeyName = null;
- private String strSequence = null;
- private String strTime = null;
+ private int strSequence = -1;
+ private long strTime = -1;
private String strAPIName = null;
private String strInitializeTime = null;
private String strTerminateTime = null;
private String strParentName = null;
private String strParentClassName = null;
- private String strParentPointer = null;
+ private long strParentPointer = -1;
private String strChildName = null;
private String strChildClassName = null;
- private String strChildPointer = null;
+ private long strChildPointer = -1;
private String strControlType = null;
- private List<String> data;
+ private LogData data;
- public UIControlListData(String[] input) {
- List<String> data = getData();
- for (int i = 0; i < input.length; i++) {
- data.add(input[i]);
- }
- }
+ // public UIControlListData(String[] input) {
+ // List<String> data = getLogData();
+ // for (int i = 0; i < input.length; i++) {
+ // data.add(input[i]);
+ // }
+ // }
- public UIControlListData(List<String> input) {
- if (null != input && !input.isEmpty()) {
- getData().addAll(input);
- }
+ public UIControlListData(LogData input) {
+ data = input.getClone();
}
- public List<String> getData() {
- if (null == data) {
- data = new ArrayList<String>();
- }
+ public LogData getData() {
return data;
}
- public String getLogData(int logIndex) {
- if (!getData().isEmpty()) {
- return data.get(logIndex);
- }
- return null;
- }
+ // public String getData(int logIndex) {
+ // if (!getData().isEmpty()) {
+ // return data.get(logIndex);
+ // }
+ // return null;
+ // }
- public void setSequence(String data) {
- strSequence = data;
+ public void setSequence(int seq) {
+ strSequence = seq;
}
- public String getSequence() {
- if (strSequence == null) {
- strSequence = CommonConstants.EMPTY;
- }
+ public int getSequence() {
return strSequence;
}
return strCalssKeyName;
}
- public void setTime(String data) {
- strTime = data;
+ public void setTime(long time) {
+ strTime = time;
}
- public String getTime() {
- if (strTime == null) {
- strTime = CommonConstants.EMPTY;
- }
+ public long getTime() {
return strTime;
}
return strTerminateTime;
}
- public void setParentPointer(String data) {
+ public void setParentPointer(long data) {
strParentPointer = data;
}
- public String getParentPointer() {
- if (strParentPointer == null) {
- strParentPointer = CommonConstants.EMPTY;
- }
+ public long getParentPointer() {
return strParentPointer;
}
return strChildClassName;
}
- public void setChildPointer(String data) {
+ public void setChildPointer(long data) {
strChildPointer = data;
}
- public String getChildPointer() {
- if (strChildPointer == null) {
- strChildPointer = CommonConstants.EMPTY;
- }
+ public long getChildPointer() {
return strChildPointer;
}
}
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.SymbolManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ControlData;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingData;
private List<UIControlListData> controlList = null;
private List<String> removeCallControlList = null;
- private String preSeq = CommonConstants.EMPTY;
+ private int preSeq = -1;
- public void parserLog(List<String> input) {
+ public void parserLog(ControlData input) {
- String stClassName = getClassName(
- input.get(LogCenterConstants.APINAME_INDEX)).trim();
+ String stClassName = getClassName(input.getApiName()).trim();
if (stClassName.equals("AddFrame") || stClassName.equals("AddControl")) {//$NON-NLS-1$ //$NON-NLS-2$
- if (isExistData(
- input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX),
- input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX)) == true) {
+ if (isExistData(input.getParentClassName(),
+ input.getChildClassName()) == true) {
return;
}
- if (preSeq.equals(input
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX))) {
+ if (preSeq == input.getSeq()) {
return;
}
addSortData(makeUIControlListData(input));
setUIControlListTimeData();
- preSeq = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ preSeq = input.getSeq();
} else if (stClassName.trim().equals("RemoveControl")) {//$NON-NLS-1$
- getRemoveCallControlList()
- .add(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
+ getRemoveCallControlList().add(input.getChildClassName());
} else if (stClassName.trim().equals("SetName")//$NON-NLS-1$
|| stClassName.equals("RemoveFrame")//$NON-NLS-1$
|| stClassName.equals("RemoveAllControl")) {//$NON-NLS-1$
}
}
- private UIControlListData makeUIControlListData(List<String> input) {
+ private UIControlListData makeUIControlListData(ControlData input) {
UIControlListData controlData = new UIControlListData(input);
- controlData.setSequence(input
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+ controlData.setSequence(input.getSeq());
- controlData.setTime(input.get(LogCenterConstants.TIME_INDEX));
+ controlData.setTime(input.getTime());
- controlData.setAPIName(getClassName(
- input.get(LogCenterConstants.APINAME_INDEX)).trim());
+ controlData.setAPIName(getClassName(input.getApiName()).trim());
controlData.setInitializeTime(CommonConstants.DASH);
controlData.setTerminateTime(CommonConstants.DASH);
- controlData
- .setParentName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX));
- controlData
- .setParentClassName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX));
- controlData
- .setParentPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX));
+ controlData.setParentName(input.getParentName());
+ controlData.setParentClassName(input.getParentClassName());
+ controlData.setParentPointer(input.getParentPointer());
- controlData
- .setChildName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+ controlData.setChildName(input.getChildName());
StringBuilder childClassNameDemangling = new StringBuilder(
- input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
+ input.getChildClassName());
childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
String childClassName = SymbolManager
.demanglingFunctionName(childClassNameDemangling.toString());
controlData.setChildClassName(childClassName);
- controlData
- .setChildPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX));
+ controlData.setChildPointer(input.getChildPointer());
- controlData
- .setControlType(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+ controlData.setControlType(input.getChildName());
controlData.setCalssKeyName(getClassName(input));
return controlData;
private void addSortData(UIControlListData data) {
int nSize = getDataList().size();
for (int i = 0; i < nSize; i++) {
- if (data.getParentPointer().trim().equals(CommonConstants.EMPTY)) {
+ if (data.getParentPointer() == -1) {
getDataList().add(0, data);
return;
- } else if (getDataList().get(i).getChildPointer()
- .equals(data.getParentPointer())) {
+ } else if (getDataList().get(i).getChildPointer() == data
+ .getParentPointer()) {
getDataList().add(i + 1, data);
return;
- } else if (getDataList().get(i).getParentPointer()
- .equals(data.getChildPointer())) {
+ } else if (getDataList().get(i).getParentPointer() == data
+ .getChildPointer()) {
int insertIndex = 0;
if (i - 1 < 0) {
insertIndex = 0;
return demangleName;
}
- private String getClassName(List<String> dataFormat) {
- String apiName = dataFormat.get(LogCenterConstants.APINAME_INDEX);
+ public String getClassName(ControlData dataFormat) {
+ String apiName = dataFormat.getApiName();
if (apiName.contains("AddFrame")) {//$NON-NLS-1$
- String className = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX);
+ String className = dataFormat.getChildClassName();
return getDemanglingName(className);
}
- String controlTyp = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX);
+ String controlTyp = dataFormat.getChildName();
String className = CommonConstants.EMPTY;
if (controlTyp.contains("Panel") || controlTyp.contains("Form")) {//$NON-NLS-1$//$NON-NLS-2$
- className = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX);
+ className = dataFormat.getChildClassName();
} else {
- className = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX);
+ className = dataFormat.getParentClassName();
}
return getDemanglingName(className);
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TreeInput;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ControlData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIListTableCellRenderer;
}
DATableDataFormat dataFormat = (DATableDataFormat) items[0]
.getData();
- String className = dataFormat.getData().get(
- dataFormat.getData().size() - 1);
+ ControlData data = (ControlData) dataFormat.getLogData();
+ String className = UIDataManager.getInstance()
+ .getControlDataChecker().getClassName(data);
UIDataManager.getInstance().setTableSeleteClassName(className);
- String time = getSnapsotForScene(className, dataFormat
- .getData().get(LogCenterConstants.TIME_INDEX));
+ long time = getSnapsotForScene(className, data.getTime());
DASelectionData selData = new DASelectionData(
- UIControlListView.ID, Long.parseLong(time), 0, items,
- table);
+ UIControlListView.ID, time, 0, items, table);
AnalyzerManager.getCurrentPage().controlSelection(
UIControlListView.ID);
});
}
- private String getSnapsotForScene(String className, String strTime) {
- String time = UIDataManager.getInstance().getFindSnapshotViewHashMap()
+ private long getSnapsotForScene(String className, long strTime) {
+ long time = UIDataManager.getInstance().getFindSnapshotViewHashMap()
.get(className);
- if (time == null) {
+ if (time == -1) {
time = strTime;
}
- String result = SqlManager.getInstance().getLastSnapshotTime(time);
- if (result == null) {
+ long result = SqlManager.getInstance().getLastSnapshotTime(time);
+ if (result == -1) {
result = strTime;
}
return result;
private TreeInput makeInput(UIControlListData input) {
DATableDataFormat tableData = new DATableDataFormat(input.getSequence());
- List<String> inputData = new ArrayList<String>();
+ // List<String> inputData = new ArrayList<String>();
// make input data
- int nSize = input.getData().size();
- for (int j = 0; j < nSize; j++) {
- inputData.add(input.getData().get(j));
- }
- inputData.add(input.getCalssKeyName());
- tableData.getData().addAll(inputData);
+ // int nSize = input.getLogData().size();
+ // for (int j = 0; j < nSize; j++) {
+ // inputData.add(input.getLogData().get(j));
+ // }
+ // inputData.add(input.getCalssKeyName());
+ LogData inputData = input.getData();
+ tableData.setLogData(inputData);
tableData.setObject(input.getChildClassName());
List<String> text = new ArrayList<String>();
output.setText(text);
output.setData(tableData);
- output.setParent(input.getParentPointer());
- output.setChild(input.getChildPointer());
+ output.setParent(Long.toString(input.getParentPointer()));
+ output.setChild(Long.toString(input.getChildPointer()));
String strSelectedClassname = UIDataManager.getInstance()
.getTableSeleteClassName();
int size = controlList.size();
int nNodeDepth = 0;
for (int i = 0; i < size; i++) {
-// System.out.println("sort " + i + " " + controlList.get(i).getData());
+ // System.out.println("sort " + i + " " +
+ // controlList.get(i).getData());
TreeInput currentNode = makeInput(controlList.get(i));
if (isRootNode(controlList, i)) {
output.add(currentNode);
return false;
}
for (int i = 0; i < index; i++) {
- if (controlList.get(i).getChildPointer()
- .equals(controlList.get(index).getParentPointer())) {
+ if (controlList.get(i).getChildPointer() == (controlList.get(index)
+ .getParentPointer())) {
isRootNode = false;
break;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.nl.UserInterfacePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingView;
import org.tizen.dynamicanalyzer.ui.userinterface.scene.UISceneListView;
package org.tizen.dynamicanalyzer.ui.userinterface.profiling;
import java.util.ArrayList;
-import java.util.List;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
import org.tizen.dynamicanalyzer.utils.Formatter;
public static final int USER_INTERFACE_PROFILING_DATABLEDATAFORMAT_CLASSNAME_INDEX = 10;
private String strCalssKeyName = null;
- private String strSequence = null;
- private String strTime = null;
+ private int strSequence = -1;
+ private long longTime = -1;
private String strKey = null;
private String strAPIName = null;
private String strParent = null;
private String strTreeKey = null;
- private List<String> data = null;
+ private LogData data = null;
- private ArrayList<ProfilingData> profilingData = null;
+ private ArrayList<ProfilingData> profilingData = new ArrayList<ProfilingData>();
public UIFunctionProfilingData(String[] input) {
- List<String> data = getData();
- for (int i = 0; i < input.length; i++) {
- data.add(input[i]);
- }
+ // List<String> data = getLogData();
+ // for (int i = 0; i < input.length; i++) {
+ // data.add(input[i]);
+ // }
}
- public UIFunctionProfilingData(List<String> input) {
- if (null != input && !input.isEmpty()) {
- getData().addAll(input);
- }
+ public UIFunctionProfilingData(LogData input) {
+ data = input;
}
public UIFunctionProfilingData(ProfilingData input) {
}
}
+ public ArrayList<ProfilingData> getProfilingData() {
+ return profilingData;
+ }
+
public UIFunctionProfilingData() {
}
- public List<String> getData() {
- if (null == data) {
- data = new ArrayList<String>();
- }
+ public LogData getData() {
return data;
}
- public String getLogData(int logIndex) {
- if (!getData().isEmpty()) {
- return data.get(logIndex);
- }
- return null;
- }
+ // public String getLogData(int logIndex) {
+ // if (!getLogData().isEmpty()) {
+ // return data.get(logIndex);
+ // }
+ // return null;
+ // }
- public void setSequence(String data) {
+ public void setSequence(int data) {
strSequence = data;
}
- public String getSequence() {
+ public int getSequence() {
return strSequence;
}
return strKey;
}
- public void setTime(String data) {
- strTime = data;
+ public void setTime(long data) {
+ longTime = data;
}
public String getTime() {
- if (strTime == null) {
- return strTime = CommonConstants.EMPTY;
- }
- return Formatter.toTimeFormat(strTime);
+ return Formatter.toTimeFormat(longTime);
}
public void setParent(String data) {
static boolean InitUIApiList = false;
static List<String> isUiApiCheckList = new ArrayList<String>();
- final String UI_API_TRUE = "true";//$NON-NLS-1$
- final String UI_API_FALSE = "false";//$NON-NLS-1$
+ static final String UI_API_TRUE = "true";//$NON-NLS-1$
+ static final String UI_API_FALSE = "false";//$NON-NLS-1$
static int nUserProfilingDataCount = 0;
public boolean addProfilingData(ProfilingData input) {
int nListSize = getDataList().size();
for (int i = 0; i < nListSize; i++) {
- if (getDataList().get(i).getSequence()
- .equals(input.getSequence())) {
+ if (getDataList().get(i).getSequence() == input.getSequence()) {
getDataList().remove(i);
nChangedIndex = i;
bUpdateData = true;
inAvgTime = getAvgTime(Integer.parseInt(inTime),
input.getCallCount(), 2);
inTime = Formatter.toTimeFormat2(inTime);
- exeTime = Long.toString(input.getElapsedTime());
- exeTime = Formatter.toTimeFormat(exeTime);
+ exeTime = Formatter.toTimeFormat(input.getElapsedTime());
exeAvgTime = getAvgTime(input.getElapsedTime(),
input.getCallCount(), 1);
- inExeTime = Long.toString(input.getExclusiveElapsedTime());
- inExeTime = Formatter.toTimeFormat(inExeTime);
+ inExeTime = Formatter.toTimeFormat(input
+ .getExclusiveElapsedTime());
inExeAvgTime = getAvgTime(input.getExclusiveElapsedTime(),
input.getCallCount(), 1);
} catch (NumberFormatException e) {
if (bUpdateData == true) {
getDataList().add(nChangedIndex, pd);
} else {
- nChangedIndex = nListSize;
getDataList().add(pd);
}
return true;
private String getAvgTime(long nTime, int nCount, int nType) {
String strRetrun = "00.000";//$NON-NLS-1$
+ long time = -1;
if (nTime == 0) {
return strRetrun;
} else if (nCount == 0) {
- strRetrun = Long.toString(nTime);
+ time = nTime;
} else {
- long nAvgExeTime = (nTime / nCount);
- strRetrun = Long.toString(nAvgExeTime);
+ // avg exe time
+ time = (nTime / nCount);
}
if (nType == 1) {
- strRetrun = Formatter.toTimeFormat(strRetrun);
+ strRetrun = Formatter.toTimeFormat(time);
} else {
- strRetrun = Formatter.toTimeFormat2(strRetrun);
+ strRetrun = Formatter.toTimeFormat2(time);
}
return strRetrun;
}
private void makeRootParentData(ProfilingData input) {
UIFunctionProfilingData pd = new UIFunctionProfilingData();
String exTime = CommonConstants.DASH, inTime = CommonConstants.DASH, exeTime = CommonConstants.DASH, inExeTime = CommonConstants.DASH, exAvgTime = CommonConstants.DASH, inAvgTime = CommonConstants.DASH, exeAvgTime = CommonConstants.DASH, inExeAvgTime = CommonConstants.DASH;
- pd.setSequence(CommonConstants.ZERO);
+ pd.setSequence(0);
pd.setKey(input.getKey());
pd.setAPINamee(input.getParent());
pd.setExclCPUTime(exTime);
String uiFileOptionList = null;
String uiApiOptionList = null;
String uiOptionList = getUIApiOptionList();
+ if (uiOptionList == null) {
+ return;
+ }
if (uiOptionList.contains(CommonConstants.SEMICOLON) == false) {
return;
}
}
}
+ if (uiFileOptionList == null) {
+ return;
+ }
if (uiFileOptionList.contains(AnalyzerConstants.DATA_PARSING_TOKEN) == false) {
return;
}
String[] splitUiFileOptionList = uiFileOptionList
.split(AnalyzerConstants.DATA_PARSING_TOKEN);
+ if (uiApiOptionList == null) {
+ return;
+ }
if (uiApiOptionList.contains(AnalyzerConstants.DATA_PARSING_TOKEN) == false) {
return;
}
.split(AnalyzerConstants.DATA_PARSING_TOKEN);
File[] files = sourceFolder.listFiles();
+ if (files == null) {
+ return;
+ }
String filename = null;
int filelength = files.length;
for (int i = 0; i < filelength; i++) {
}
private String getUIApiOptionList() {
- String uiApiOptionList = new String();
+ String uiApiOptionList = null;
+ ;
String configFileName = AnalyzerConstants.USER_INTERFACE_API_LIST_FILE_NAME;
File configFolder = new File(AnalyzerPaths.CONFIG_FOLDER_PATH);
if (!configFolder.isDirectory()) {
List<String> inputData = new ArrayList<String>();
// make input data
- inputData.add(input.getSequence());
+ inputData.add(Integer.toString(input.getSequence()));
inputData.add(input.getAPIName());
inputData.add(input.getInclEsapsedTime());
inputData.add(input.getInclEsapsedAvgTime());
package org.tizen.dynamicanalyzer.ui.userinterface.scene;
-import java.util.ArrayList;
-import java.util.List;
-
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class UISceneData {
public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_DATABLEDATAFORMAT_CLASSNAME_INDEX = 21;
private String strCalssKeyName = null;
- private String strSequence = null;
- private String strTime = null;
+ private int strSequence = -1;
+ private long strTime = -1;
private String strSceneName = null;
private String strTransformTime = null;
private String strFormName = null;
private String strPanelName = null;
- private List<String> data;
+ private LogData data;
- public UISceneData(String[] input) {
- List<String> data = getData();
- for (int i = 0; i < input.length; i++) {
- data.add(input[i]);
- }
- }
+ // public UISceneData(String[] input) {
+ // List<String> data = getLogData();
+ // for (int i = 0; i < input.length; i++) {
+ // data.add(input[i]);
+ // }
+ // }
- public UISceneData(List<String> sceneLoginput) {
- if (null != sceneLoginput && !sceneLoginput.isEmpty()) {
- getData().addAll(sceneLoginput);
+ public UISceneData(LogData sceneLoginput) {
+ if (null != sceneLoginput) {
+ data = sceneLoginput.getClone();
}
}
- public List<String> getData() {
- if (null == data) {
- data = new ArrayList<String>();
- }
+ public LogData getData() {
return data;
}
- public String getLogData(int logIndex) {
- if (!getData().isEmpty()) {
- return data.get(logIndex);
- }
- return null;
- }
-
- public void setSequence(String data) {
+ public void setSequence(int data) {
strSequence = data;
}
- public String getSequence() {
- if (strSequence == null) {
- strSequence = CommonConstants.EMPTY;
- }
+ public int getSequence() {
return strSequence;
}
return strCalssKeyName;
}
- public void setTime(String data) {
+ public void setTime(long data) {
strTime = data;
}
public String getTime() {
- if (strTime == null) {
- return strTime = CommonConstants.EMPTY;
- }
return Formatter.toTimeFormat(strTime);
}
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.SymbolManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SceneData;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.utils.Formatter;
List<UISceneData> transfomSceneList;
- public void parserLog(List<String> input) {
+ public void parserLog(SceneData input) {
UISceneData sceneData = new UISceneData(input);
- sceneData.setSequence(input
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- sceneData.setTime(input.get(LogCenterConstants.TIME_INDEX));
- sceneData
- .setSceneName(input
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX));
- sceneData
- .setFormName(input
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_NAME_INDEX));
- sceneData
- .setPanelName(input
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_NAME_INDEX));
+ sceneData.setSequence(input.getSeq());
+ sceneData.setTime(input.getTime());
+ sceneData.setSceneName(input.getSceneName());
+ sceneData.setFormName(input.getFormName());
+ sceneData.setPanelName(input.getPanelName());
sceneData.setCalssKeyName(getClassName(input));
sceneData
- .setTransformTime(getTransitionTime(input
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_TRANSITION_INDEX)));
+ .setTransformTime(getTransitionTime(input.getTransitionTime()));
getDataList().add(sceneData);
- UIDataManager
- .getInstance()
- .getFindSnapshotViewHashMap()
- .put(getClassName(input),
- input.get(LogCenterConstants.TIME_INDEX));
+ UIDataManager.getInstance().getFindSnapshotViewHashMap()
+ .put(getClassName(input), input.getTime());
}
public List<UISceneData> getDataList() {
return transfomSceneList;
}
- private String getTransitionTime(String time) {
- if (time.trim().equals(CommonConstants.EMPTY)) {
- return time = "00:00.000";//$NON-NLS-1$
+ private String getTransitionTime(int time) {
+ if (time == -1 || time == 0) {
+ return "00:00.000";//$NON-NLS-1$
}
- time = time + "00";//$NON-NLS-1$
+ time *= 100;
return Formatter.toTimeFormat(time);
}
- public String getClassName(List<String> dataFormat) {
- String className = CommonConstants.EMPTY;
- String panelName = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_POINTER_INDEX);
- if (panelName.equals(CommonConstants.EMPTY)) { //
- className = dataFormat
- .get(LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_POINTER_INDEX);
+ public String getClassName(SceneData dataFormat) {
+ long classPointer = -1;
+ long panelPointer = dataFormat.getPanelPointer();
+ if (panelPointer == -1) { //
+ classPointer = dataFormat.getFormPointer();
} else {
- className = panelName;
+ classPointer = panelPointer;
}
- StringBuilder childClassNameDemangling = new StringBuilder(className);
+ StringBuilder childClassNameDemangling = new StringBuilder(
+ Long.toString(classPointer));
childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
- className = SymbolManager
+ String className = SymbolManager
.demanglingFunctionName(childClassNameDemangling.toString());
return className;
}
-
}
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.model.probe2.SceneData;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
}
DATableDataFormat dataFormat = (DATableDataFormat) items[0]
.getData();
- UIDataManager.getInstance().setTableSeleteClassName(
- dataFormat.getData().get(
- dataFormat.getData().size() - 1));
- String time = getSnapsotForScene(dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX));
+ SceneData data = (SceneData) dataFormat.getData();
+ String className = UIDataManager.getInstance()
+ .getSceneTransformDataChecker().getClassName(data);
+ UIDataManager.getInstance().setTableSeleteClassName(className);
+ long time = getSnapsotForScene(data.getTime());
DASelectionData selData = new DASelectionData(
- UISceneListView.ID, Long.parseLong(time), 0, items,
- table);
+ UISceneListView.ID, time, 0, items, table);
AnalyzerManager.getCurrentPage().updatePage(selData);
AnalyzerManager.getCurrentPage().controlSelection(
UISceneListView.ID);
});
}
- private String getSnapsotForScene(String strTime) {
- String result = SqlManager.getInstance().getLastSnapshotTime(strTime);
- if (result == null) {
+ private long getSnapsotForScene(long strTime) {
+ long result = SqlManager.getInstance().getLastSnapshotTime(strTime);
+ if (result == -1) {
result = strTime;
}
return result;
List<String> text = new ArrayList<String>();
UISceneData sceneTransformsData = transfomSceneList.get(i);
- List<String> inputData = new ArrayList<String>();
- int nSize = sceneTransformsData.getData().size();
- for (int j = 0; j < nSize; j++) {
- inputData.add(sceneTransformsData.getData().get(j));
- }
- inputData.add(sceneTransformsData.getCalssKeyName());
+ // List<String> inputData = new ArrayList<String>();
+ // int nSize = sceneTransformsData.getLogData().size();
+ SceneData inputData = (SceneData) sceneTransformsData.getData();
+ // for (int j = 0; j < nSize; j++) {
+ // inputData.add(sceneTransformsData.getLogData().get(j));
+ // }
+ // inputData.add(sceneTransformsData.getCalssKeyName());
DATableDataFormat tableData = new DATableDataFormat(
sceneTransformsData.getSequence());
- tableData.getData().addAll(inputData);
+ tableData.setLogData(inputData);
text.add(sceneTransformsData.getTime()); // Time
text.add(sceneTransformsData.getSceneName()); // Scene Name
text.add(sceneTransformsData.getFormName()); // Form Name
}
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- long time = Long.parseLong(tableData.getData().get(
- LogCenterConstants.TIME_INDEX));
- long analysisStartTime = RangeDataManager.getInstance().getAnalysisStartTime();
- long analysisEndTime = RangeDataManager.getInstance().getAnalysisEndTime();
+ long time = tableData.getLogData().getTime();
+ long analysisStartTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
+ long analysisEndTime = RangeDataManager.getInstance()
+ .getAnalysisEndTime();
if (time >= analysisStartTime && time <= analysisEndTime) {
tableInput.setInRange(true);
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
shell.open();
- Display display = PlatformUI.createDisplay();
+ Display display = Display.getCurrent();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
private boolean closable = false;
protected int closeState = STATE_NORMAL;
- protected TabButtonRenderer tabRenderer;
+// protected TabButtonRenderer tabRenderer;
protected Rectangle closeRect = null;
protected DACustomButtonClickEventListener closeListener = null;
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.common.DesignConstants;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
}
@Override
- public void setSelection(List<String> data) {
+ public void setSelection(LogData data) {
int size = getTabChildren().size();
for (int i = 0; i < size; i++) {
((ViewAction) getTabChildren().get(i)).setSelection(data);
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.model.FindProperty;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
viewName = ((DATreeComposite) comp).getTableName();
} else {
table = null;
+ return;
}
this.composite = comp;
findProperty = DATableComposite.getFindProferty();
shell.setLayout(new FormLayout());
shell.setSize(340, 130);
shell.setBackground(ColorResources.DIALOG_BG_UPPER);
- shell.setText(AnalyzerLabels.FIND_DLG_TITLE_PREFIX + viewName
+ shell.setText(AnalyzerLabels.FIND_DLG_TITLE_PREFIX
+ + CommonConstants.SPACE + viewName + CommonConstants.SPACE
+ AnalyzerLabels.FIND_DLG_TITLE_POSTFIX);
textBox = new Text(shell, SWT.SINGLE);
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
public class DAApiListTableComposite extends DATableComposite {
int tableStyle) {
super(parent, compStyle, tableStyle);
setRangePopup();
-
+
setComparator(new DefaultTableComparator());
comparator.setType(AnalyzerConstants.SORT_TYPE_NUM);
comparator.setColumn(0);
for (int i = 0; i < size; i++) {
DATableDataFormat dataFormat = (DATableDataFormat) items[i]
.getData();
- String timeStr = dataFormat.getData().get(
- LogCenterConstants.TIME_INDEX);
- long time = Long.valueOf(timeStr);
+ long time = dataFormat.getLogData().getTime();
if (time < startTime) {
if (time > topIndexTime) {
int topMargin = 0;
int bottomMargin = 0;
int textTopMargin = 1;
- int textBottomMargin = 2;
int insideMargin = 3;
- int treeIndent = 20;
protected DATableToggleRenderer toggleRenderer;
protected CheckBoxRenderer checkRenderer;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.FindProperty;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
protected boolean ctrlPressed = false;
protected Grid table;
- protected int itemCount = 0;
protected List<Integer> selectionIndex;
- protected HashMap<String, String> selection;
+ protected HashMap<Long, Long> selection;
protected TableTooltipListener tableListener;
protected boolean isTree = false;
- protected String focusSeq = null;
+ protected long focusSeq = -1;
protected Color rangeColor = ColorResources.TABLE_RANGE_COLOR_RANGE;
protected Color secondSelectionColor = ColorResources.TABLE_RANGE_COLOR_SECOND_SELECTION;
}
int size = ti.length;
- HashMap<String, String> sel = getSelections();
+ HashMap<Long, Long> sel = getSelections();
sel.clear();
for (int i = 0; i < size; i++) {
DATableDataFormat tableData = (DATableDataFormat) ti[i]
.getData();
if (null != tableData) {
- String seq = tableData.getSelectionKey();
- if (null != seq && !seq.isEmpty()) {
+ long seq = tableData.getSelectionKey();
+ if (-1 != seq) {
sel.put(seq, seq);
}
}
public void updateTable() {
GridItem[] selections = table.getSelection();
- List<String> selSeqs = new ArrayList<String>();
+ List<Long> selSeqs = new ArrayList<Long>();
for (int i = 0; i < selections.length; i++) {
DATableDataFormat tableData = (DATableDataFormat) selections[i]
.getData();
- List<String> data = tableData.getData();
- selSeqs.add(data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+ LogData data = tableData.getLogData();
+ selSeqs.add((long) data.getSeq());
}
table.removeAll();
List<TableInput> input = makeTableInput();
- if (null == input) {
+ if (null == input || input.isEmpty()) {
return;
}
if (null != comparator) {
}
if (gridData != null) {
- String seqNum = gridData.getSelectionKey();
+ long seqNum = gridData.getSelectionKey();
for (int ii = 0; ii < selSeqs.size(); ii++) {
- if (seqNum.equals(selSeqs.get(ii))) {
+ if (seqNum == selSeqs.get(ii)) {
sels[iii++] = i;
selSeqs.remove(ii);
}
}
- if (null != focusSeq && seqNum.equals(focusSeq)) {
+ if (-1 != focusSeq && seqNum == focusSeq) {
focusIndex = i;
}
}
protected abstract List<TableInput> makeTableInput();
- public HashMap<String, String> getSelections() {
+ public HashMap<Long, Long> getSelections() {
if (null == selection) {
- selection = new HashMap<String, String>();
+ selection = new HashMap<Long, Long>();
}
return selection;
}
protected void actionSetStartEnd(int type) {
GridItem item = table.getItem(mousePoint);
if (null != item) {
- List<String> data = ((DATableDataFormat) item.getData()).getData();
- String time = data.get(LogCenterConstants.TIME_INDEX);
- long inputTime = -1;
- try {
- inputTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
+ LogData data = ((DATableDataFormat) item.getData()).getLogData();
+ long inputTime = data.getTime();
if (type == START_TIME) {
rangeDataManager.setMarkerStartTime(inputTime);
} else if (type == END_TIME) {
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
public class DATableDataFormat {
- protected List<String> data = null;
+ protected LogData logData = null;
protected Object obj = null;
- protected String selectionKey = null;
+ protected long selectionKey = -1;
+ protected int type = 0;
+ protected List<String> data = new ArrayList<String>();
- public DATableDataFormat(String selectionKey) {
+ public DATableDataFormat(long selectionKey) {
this.selectionKey = selectionKey;
}
- public List<String> getData() {
- if (null == data) {
- data = new ArrayList<String>();
- }
- return data;
+ public LogData getLogData() {
+ return logData;
+ }
+
+ public void setLogData(LogData input) {
+ logData = input;
}
public Object getObject() {
this.obj = obj;
}
- public String getSelectionKey() {
+ public long getSelectionKey() {
return selectionKey;
}
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public List<String> getData() {
+ return data;
+ }
}
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridCellRenderer;
-import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.tizen.dynamicanalyzer.resources.ColorResources;
Grid table = null;
if (value instanceof Grid) {
table = (Grid) value;
- }
-
- GridItem item = null;
- if (value instanceof GridItem) {
- item = (GridItem) value;
- table = item.getParent();
+ } else {
+ return;
}
boolean drawBackground = true;
gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_START);
gc.setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END);
} else {
- if (table.isEnabled() && null != item) {
- Color bg = item.getBackground();
- if (bg != null) {
- gc.setBackground(bg);
- } else {
- drawBackground = false;
- }
+ if (table.isEnabled()) {
+ drawBackground = false;
} else {
gc.setBackground(getDisplay().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
int topMargin = 3;
- int bottomMargin = 3;
+// int bottomMargin = 3;
int arrowMargin = 6;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-
public class DATableToggleRenderer extends AbstractRenderer {
- public DATableToggleRenderer() {
- super();
- setSize(11, 9);
- }
+ public DATableToggleRenderer() {
+ super();
+ setSize(11, 9);
+ }
- public void paint(GC gc, Object value) {
- GridItem item = (GridItem) value;
- DATableDataFormat tableData = (DATableDataFormat) item.getData();
+ public void paint(GC gc, Object value) {
+ GridItem item = (GridItem) value;
+ DATableDataFormat tableData = (DATableDataFormat) item.getData();
- String text = ""; //$NON-NLS-1$
- Font font = item.getFont(0);
- if (null == font) {
- gc.setFont(FontResources.TABLE_CELL_FONT);
- } else {
- gc.setFont(font);
- }
+ String text = ""; //$NON-NLS-1$
+ Font font = item.getFont(0);
+ if (null == font) {
+ gc.setFont(FontResources.TABLE_CELL_FONT);
+ } else {
+ gc.setFont(font);
+ }
- String data = (String) tableData.getObject();
- text += data;
+ String data = (String) tableData.getObject();
+ text += data;
- if (item.hasChildren()) {
- if (isExpanded()) {
- Rectangle r = ImageResources.TREE_OPEN.getBounds();
- int offset = (getBounds().width - r.width) / 2;
- int x = getBounds().x + offset;
- gc.drawImage(ImageResources.TREE_OPEN, x, getBounds().y);
- x += r.width + 5;
- if (isSelected()) {
- gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
- } else {
- gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- }
- gc.drawText(text, x, getBounds().y, true);
- } else {
- Rectangle r = ImageResources.TREE_FOLD.getBounds();
- int offset = (getBounds().width - r.width) / 2;
- int x = getBounds().x + offset;
- gc.drawImage(ImageResources.TREE_FOLD, getBounds().x + offset, getBounds().y);
- x += r.width + 5;
- if (isSelected()) {
- gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
- } else {
- gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- }
- gc.drawText(text, x, getBounds().y, true);
- }
- } else {
- Rectangle r = ImageResources.TREE_OPEN.getBounds();
- int offset = (getBounds().width - r.width) / 2;
- int x = getBounds().x + offset;
- x += r.width;
- if (isSelected()) {
- gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
- } else {
- gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- }
- gc.drawText(text, x, getBounds().y, true);
- }
- }
+ if (item.hasChildren()) {
+ if (isExpanded()) {
+ Rectangle r = ImageResources.TREE_OPEN.getBounds();
+ int offset = (getBounds().width - r.width) / 2;
+ int x = getBounds().x + offset;
+ gc.drawImage(ImageResources.TREE_OPEN, x, getBounds().y);
+ x += r.width + 5;
+ if (isSelected()) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
+ } else {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ }
+ gc.drawText(text, x, getBounds().y, true);
+ } else {
+ Rectangle r = ImageResources.TREE_FOLD.getBounds();
+ int offset = (getBounds().width - r.width) / 2;
+ int x = getBounds().x + offset;
+ gc.drawImage(ImageResources.TREE_FOLD, getBounds().x + offset,
+ getBounds().y);
+ x += r.width + 5;
+ if (isSelected()) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
+ } else {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ }
+ gc.drawText(text, x, getBounds().y, true);
+ }
+ } else {
+ Rectangle r = ImageResources.TREE_OPEN.getBounds();
+ int offset = (getBounds().width - r.width) / 2;
+ int x = getBounds().x + offset;
+ x += r.width;
+ if (isSelected()) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
+ } else {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ }
+ gc.drawText(text, x, getBounds().y, true);
+ }
+ }
- /**
- * {@inheritDoc}
- */
- public Point computeSize(GC gc, int wHint, int hHint, Object value) {
- return new Point(11, 9);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public Point computeSize(GC gc, int wHint, int hHint, Object value) {
+ return new Point(11, 9);
+ }
}
public abstract class DATreeComposite extends DATableComposite {
// for selection control
- List<String> selSeqs = null;
+ List<Long> selSeqs = null;
GridItem[] selections = null;
int[] sels = null;
int gridItemCount = -1;
int selIndex = 0;
int focusIndex = -1;
- protected HashMap<Integer, Boolean> expandMap = null;
+ protected HashMap<Long, Boolean> expandMap = null;
protected HashMap<String, GridItem> gridMap = null;
public DATreeComposite(Composite parent, int style) {
super(parent, compStyle, tableStyle);
}
- private HashMap<Integer, Boolean> getExpandMap() {
+ private HashMap<Long, Boolean> getExpandMap() {
if (null == expandMap) {
- expandMap = new HashMap<Integer, Boolean>();
+ expandMap = new HashMap<Long, Boolean>();
}
return expandMap;
}
public void setExpand(GridItem item, boolean expand) {
DATableDataFormat tableData = (DATableDataFormat) item.getData();
- String seq = tableData.getSelectionKey();
- int seqNum = Integer.parseInt(seq);
+ long seqNum = tableData.getSelectionKey();
getExpandMap().remove(seqNum);
getExpandMap().put(seqNum, expand);
}
} else {
System.out
.println("it is bug!! need debug - DATreeComposite makeTreeItem");//$NON-NLS-1$
+ return null;
}
// data
DATableDataFormat gridData = (DATableDataFormat) input.getData();
// check selection
gridItemCount++;
for (int ii = 0; ii < selSeqs.size(); ii++) {
- if (gridData.getSelectionKey().equals(selSeqs.get(ii))) {
+ if (gridData.getSelectionKey() == selSeqs.get(ii)) {
sels[selIndex++] = gridItemCount;
selSeqs.remove(ii);
}
}
- if (null != focusSeq && gridData.getSelectionKey().equals(focusSeq)) {
+ if (-1 != focusSeq && gridData.getSelectionKey() == focusSeq) {
focusIndex = gridItemCount;
}
// check expand
- int seq = Integer.parseInt(gridData.getSelectionKey());
+ long seq = gridData.getSelectionKey();
Object expand = getExpandMap().get(seq);
if (null == expand) {
expandMap.put(seq, true);
public void updateTree() {
selections = table.getSelection();
- selSeqs = new ArrayList<String>();
+ selSeqs = new ArrayList<Long>();
for (int i = 0; i < selections.length; i++) {
DATableDataFormat tableData = (DATableDataFormat) selections[i]
.getData();
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.widgets.table;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.grid.Grid;
-import org.eclipse.nebula.widgets.grid.GridColumn;
-import org.eclipse.nebula.widgets.grid.GridItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.model.LogCenter;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.sql.SqlManager;
-import org.tizen.dynamicanalyzer.utils.Formatter;
-
-
-public class DAWindowingTableComposite extends Composite {
-
- protected Grid table;
- protected Composite scrollComp;
- protected ScrollBar scrollbar;
- private int itemCount = 0;
- protected List<Integer> selectionIndex;
- protected HashMap<String, String> selection;
- protected int id = -1;
- protected LogCenter logc;
- private TableTooltipListener tableListener;
- private boolean treeTable = false;
-
- public DAWindowingTableComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- public DAWindowingTableComposite(Composite parent, int compStyle,
- int tableStyle) {
- super(parent, compStyle);
- this.setLayout(new FillLayout());
- this.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
-
- scrollComp = new Composite(this, SWT.V_SCROLL);
- scrollComp.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
- scrollComp.setLayout(new FillLayout());
-
- scrollbar = scrollComp.getVerticalBar();
- scrollbar.setMaximum(100);
- scrollbar.setMinimum(0);
- scrollbar.setVisible(true);
- scrollbar.addSelectionListener(scrollbarSelectionListener);
-
- table = new Grid(scrollComp, tableStyle);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLineColor(ColorResources.TABLE_LINE);
- table.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
- table.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- table.setFont(FontResources.TABLE_CELL_FONT);
-
- table.setEmptyColumnHeaderRenderer(new DATableEmptyColumnHeaderRenderer());
- table.setEmptyCellRenderer(new DATableEmptyCellRenderer());
- setTableToolTipListener(tableListener);
-
- table.setItemHeight(16);
- // table.setItemHeight(AnalyzerUtil.getTableItemHeight(table));
- table.addControlListener(new ControlListener() {
-
- @Override
- public void controlResized(ControlEvent e) {
- itemCount = 0;
- }
-
- @Override
- public void controlMoved(ControlEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- table.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- GridItem[] ti = ((Grid) e.widget).getSelection();
- if (null == ti || ti.length == 0) {
- return;
- }
- int size = ti.length;
- HashMap<String, String> sel = getSelections();
- sel.clear();
- for (int i = 0; i < size; i++) {
- DATableDataFormat data = (DATableDataFormat) ti[i].getData();
-// String[] data = (String[]) ti[i].getData();
-// String seq = data[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- String seq = data.getSelectionKey();
- if (null != seq && !seq.isEmpty()) {
- sel.put(seq, seq);
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
- }
-
- public void setId(int logId) {
- id = logId;
- }
-
- public void setTree(boolean tree) {
- treeTable = tree;
- }
-
- public void setTableToolTipListener(TableTooltipListener tableListener) {
- table.addListener(SWT.Dispose, tableListener);
- table.addListener(SWT.KeyDown, tableListener);
- table.addListener(SWT.KeyUp, tableListener);
- table.addListener(SWT.MouseEnter, tableListener);
- table.addListener(SWT.MouseExit, tableListener);
- table.addListener(SWT.MouseMove, tableListener);
- table.addListener(SWT.MouseHover, tableListener);
- table.addListener(SWT.MouseDoubleClick, tableListener);
- }
-
- public void setColumns(String[] columnNames) {
- int size = columnNames.length;
- for (int i = 0; i < size; i++) {
- GridColumn column = new GridColumn(table, SWT.NONE);
- column.setText(columnNames[i]);
- if (treeTable && i == 0) {
- column.setTree(true);
- }
- column.setCellRenderer(new DATableCellRenderer());
- column.setHeaderRenderer(new DATableHeaderRenderer());
- column.pack();
- }
- }
-
- public void setColumnVisibility(boolean[] columnVisibility) {
- if (null == table || null == columnVisibility) {
- return;
- }
-
- int size = columnVisibility.length;
- GridColumn[] columns = table.getColumns();
- if (size != columns.length) {
- return;
- }
- for (int i = 0; i < size; i++) {
- columns[i].setVisible(columnVisibility[i]);
-
- }
- }
-
- public void setColumnSize(int[] columnSizes) {
- if (null == table || null == columnSizes) {
- return;
- }
-
- int size = columnSizes.length;
- GridColumn[] columns = table.getColumns();
- if (size != columns.length) {
- return;
- }
-
- for (int i = 0; i < size; i++) {
- if (columnSizes[i] == 0) {
- columns[i].pack();
- } else {
- columns[i].setWidth(columnSizes[i]);
- }
- }
- }
-
- public Grid getTable() {
- return table;
- }
-
- public ScrollBar getScrollBar() {
- return scrollbar;
- }
-
- public void setSourceViewEnable(boolean enable) {
-
- }
-
- public void updateTable() {
- LogCenter logc = AnalyzerManager.getLogCenterById(id);
- if (null == logc) {
- return;
- }
- List<Integer> order = logc.getColumnOrder();
-
- int maxItemCount = logc.getDataSize();
- int itemCount = getItemCount();
- int count = (maxItemCount > itemCount) ? itemCount : maxItemCount;
- table.setItemCount(count);
-
- scrollbar.setMaximum(maxItemCount);
- scrollbar.setThumb(itemCount);
- int selection = scrollbar.getSelection();
- int tableItemIndex = 0;
- int tableRowSize = table.getItemCount();
-
- List<List<String>> output = SqlManager.getInstance().selectRowId(logc, selection,
- selection + itemCount + 1);
- if (null == output) {
- return;
- }
-
- if (null != output && !output.isEmpty()) {
- getSelectionIndex().clear();
- for (int i = 0; i < itemCount && tableItemIndex < tableRowSize; i++, tableItemIndex++) {
- List<String> outputList = output.get(i);
- int arraySize = outputList.size();
-
- String[] inputText = new String[arraySize];
- outputList.toArray(inputText);
-
-// String[] inputData = new String[arraySize];
- List<String> inputData = new ArrayList<String>();
- int size = outputList.size();
- for (int ii = 0; ii < size; ii++) {
- if (ii + 1 == size) {
- inputData.add(outputList.get(0));
- } else {
- inputData.add(outputList.get(ii + 1));
- }
- }
- DATableDataFormat tableData = new DATableDataFormat(inputData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- tableData.getData().addAll(inputData);
- // outputList.toArray(inputData);
-
- GridItem ti = table.getItem(tableItemIndex);
- ti.setData(tableData);
- Formatter.tableItemTimeFormatting(inputText);
- String reorder[] = new String[inputText.length];
-
- int columnCount = table.getColumnCount();
- for (int index = 0; index < inputText.length
- && index < columnCount; index++) {
- reorder[index] = inputText[order.get(index)];
- }
- int inputSize = reorder.length;
-
- for (int ii = 0; ii < inputSize && ii < columnCount; ii++) {
- if (reorder[ii] == null) {
- ti.setText(ii, ""); //$NON-NLS-1$
- } else {
- ti.setText(ii, reorder[ii]);
- }
- }
-
- String seq = tableData.getSelectionKey();
-// String seq = inputData[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- if (null != getSelections().get(seq)) {
- getSelectionIndex().add(tableItemIndex);
- }
- }
-
- if (!selectionIndex.isEmpty()) {
- int[] sels = new int[selectionIndex.size()];
- for (int i = 0; i < selectionIndex.size(); i++) {
- sels[i] = selectionIndex.get(i);
- }
- table.setSelection(sels);
- } else {
- table.deselectAll();
- }
- }
-
- }
-
- public HashMap<String, String> getSelections() {
- if (null == selection) {
- selection = new HashMap<String, String>();
- }
- return selection;
- }
-
- public List<Integer> getSelectionIndex() {
- if (null == selectionIndex) {
- selectionIndex = new ArrayList<Integer>();
- }
- return selectionIndex;
- }
-
- public int getItemCount() {
- if (0 == itemCount) {
- Rectangle rect = table.getClientArea();
- int itemHeight = table.getItemHeight();
- itemCount = (rect.height - table.getHeaderHeight()) / itemHeight
- - 1;
- }
- return itemCount;
- }
-
- private SelectionListener scrollbarSelectionListener = new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateTable();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- };
-}
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.Formatter;
-
public class WindowingTable extends Composite {
protected Grid table = null;
protected int itemCount = 0;
protected int type = 0;
protected List<Integer> columnSize;
-// private TableTooltipListener tableListener;
+ // private TableTooltipListener tableListener;
protected HashMap<String, String> selection;
protected List<Integer> selectionIndex;
}
}
- //FIXME not used
-// String[] data = (String[]) ti[0].getData();
-//
-// Long selUsec = Long
-// .parseLong(data[LogCenterConstants.TIME_INDEX + 1]);
-
-// Long selMsec = selUsec / TimelineConstants.TIME_US_TO_MS;
-// TimelineComposite timelineComposite = AnalyzerUtil
-// .getTimelineComposite();
-// if (null != timelineComposite) {
-// timelineComposite.setDownTimeSelection(selMsec, false);
-// }
+ // FIXME not used
+ // String[] data = (String[]) ti[0].getData();
+ //
+ // Long selUsec = Long
+ // .parseLong(data[LogCenterConstants.TIME_INDEX + 1]);
+
+ // Long selMsec = selUsec / TimelineConstants.TIME_US_TO_MS;
+ // TimelineComposite timelineComposite = AnalyzerUtil
+ // .getTimelineComposite();
+ // if (null != timelineComposite) {
+ // timelineComposite.setDownTimeSelection(selMsec, false);
+ // }
}
@Override
});
// Creates table listener.
-// tableListener = new TableTooltipListener(table, false);
-// // Adds table listener.
-// table.addListener(SWT.Dispose, tableListener);
-// table.addListener(SWT.KeyDown, tableListener);
-// table.addListener(SWT.KeyUp, tableListener);
-// table.addListener(SWT.MouseEnter, tableListener);
-// table.addListener(SWT.MouseExit, tableListener);
-// table.addListener(SWT.MouseMove, tableListener);
-// table.addListener(SWT.MouseHover, tableListener);
-// table.addListener(SWT.MouseDoubleClick, tableListener);
+ // tableListener = new TableTooltipListener(table, false);
+ // // Adds table listener.
+ // table.addListener(SWT.Dispose, tableListener);
+ // table.addListener(SWT.KeyDown, tableListener);
+ // table.addListener(SWT.KeyUp, tableListener);
+ // table.addListener(SWT.MouseEnter, tableListener);
+ // table.addListener(SWT.MouseExit, tableListener);
+ // table.addListener(SWT.MouseMove, tableListener);
+ // table.addListener(SWT.MouseHover, tableListener);
+ // table.addListener(SWT.MouseDoubleClick, tableListener);
table.setItemHeight(AnalyzerUtil.getTableItemHeight(table));
}
}
public void setColumnSizes(int id) {
- LogCenter logc = AnalyzerManager.getLogCenterById(id);
- setColumnSize(logc);
- if (null != logc) {
- List<Integer> cols = logc.getColumnSize();
- int size = logc.getTotalColumnCount() - columnSize.size();
- int colsSize = cols.size();
- for (int i = 0; i < size; i++) {
- if (i >= colsSize) {
- columnSize.add(0);
- } else {
- columnSize.add(cols.get(i));
- }
- }
- }
+// LogCenter logc = AnalyzerManager.getLogCenterById(id);
+// if (null != logc) {
+// setColumnSize(logc);
+// List<Integer> cols = logc.getColumnSize();
+// int size = logc.getTotalColumnCount() - columnSize.size();
+// int colsSize = cols.size();
+// for (int i = 0; i < size; i++) {
+// if (i >= colsSize) {
+// columnSize.add(0);
+// } else {
+// columnSize.add(cols.get(i));
+// }
+// }
+// }
}
public void setColumns(LogCenter logc) {
}
public void reDrawLogTable() {
- LogCenter logc = AnalyzerManager.getLogCenterById(getType());
-
- if (null == logc) {
- return;
- }
-
- List<Integer> order = logc.getColumnOrder();
-
- if (0 == table.getColumnCount()) {
- setColumns(logc);
- }
-
- ScrollBar compositeScrollBar = comp.getVerticalBar();
- int itemCount = getItemCount();
- int maxItemCount = logc.getDataSize();
- if (maxItemCount > itemCount) {
- table.setItemCount(itemCount);
- } else {
- table.setItemCount(maxItemCount);
- }
-
- compositeScrollBar.setMaximum(maxItemCount);
- compositeScrollBar.setThumb(itemCount);
- int selection = compositeScrollBar.getSelection();
- int tableItemIndex = 0;
- int tableRowSize = table.getItemCount();
-
- if (null == AnalyzerManager.getProject()) {
- return;
- }
-
- List<List<String>> output;
- output = SqlManager.getInstance().selectRowId(logc, selection, selection + itemCount
- + 1);
- if (null != output && !output.isEmpty()) {
- int size = output.size();
- getSelectionIndex().clear();
- for (int i = 0; i < size && tableItemIndex < tableRowSize; i++, tableItemIndex++) {
- List<String> outputList = output.get(i);
- int arraySize = outputList.size();
- /* text */
- String[] inputText = new String[arraySize];
- outputList.toArray(inputText);
-
- String[] inputData = new String[arraySize];
- outputList.toArray(inputData);
-
- GridItem ti = table.getItem(tableItemIndex);
- ti.setData(inputData);
- Formatter.tableItemTimeFormatting(inputText);
- String reorder[] = new String[inputText.length];
-
- for (int index = 0; index < inputText.length; index++) {
- reorder[index] = inputText[order.get(index)];
- }
- int inputSize = reorder.length;
- for (int ii = 0; ii < inputSize; ii++) {
- ti.setText(ii, reorder[ii]);
- }
- // ti.setText(reorder);
- String seq = inputData[LogCenterConstants.SEQUENCE_NUMBER_INDEX + 1];
- if (null != getSelections().get(seq)) {
- getSelectionIndex().add(tableItemIndex);
- }
- }
- if (selectionIndex.size() != 0) {
- int[] sels = new int[selectionIndex.size()];
- for (int i = 0; i < selectionIndex.size(); i++) {
- sels[i] = selectionIndex.get(i);
- }
- table.setSelection(sels);
- } else {
- table.deselectAll();
- }
- }
+// LogCenter logc = AnalyzerManager.getLogCenterById(getType());
+//
+// if (null == logc) {
+// return;
+// }
+//
+// List<Integer> order = logc.getColumnOrder();
+//
+// if (0 == table.getColumnCount()) {
+// setColumns(logc);
+// }
+//
+// ScrollBar compositeScrollBar = comp.getVerticalBar();
+// int itemCount = getItemCount();
+// int maxItemCount = logc.getDataSize();
+// if (maxItemCount > itemCount) {
+// table.setItemCount(itemCount);
+// } else {
+// table.setItemCount(maxItemCount);
+// }
+//
+// compositeScrollBar.setMaximum(maxItemCount);
+// compositeScrollBar.setThumb(itemCount);
+// int selection = compositeScrollBar.getSelection();
+// int tableItemIndex = 0;
+// int tableRowSize = table.getItemCount();
+//
+// if (null == AnalyzerManager.getProject()) {
+// return;
+// }
+//
+// List<List<String>> output;
+// output = SqlManager.getInstance().selectRowId(logc, selection,
+// selection + itemCount + 1);
+// if (null != output && !output.isEmpty()) {
+// int size = output.size();
+// getSelectionIndex().clear();
+// for (int i = 0; i < size && tableItemIndex < tableRowSize; i++, tableItemIndex++) {
+// List<String> outputList = output.get(i);
+// int arraySize = outputList.size();
+// /* text */
+// String[] inputText = new String[arraySize];
+// outputList.toArray(inputText);
+//
+// String[] inputData = new String[arraySize];
+// outputList.toArray(inputData);
+//
+// GridItem ti = table.getItem(tableItemIndex);
+// ti.setData(inputData);
+// Formatter.tableItemTimeFormatting(inputText);
+// String reorder[] = new String[inputText.length];
+//
+// for (int index = 0; index < inputText.length; index++) {
+// reorder[index] = inputText[order.get(index)];
+// }
+// int inputSize = reorder.length;
+// for (int ii = 0; ii < inputSize; ii++) {
+// ti.setText(ii, reorder[ii]);
+// }
+// // ti.setText(reorder);
+// String seq = inputData[LogCenterConstants.SEQUENCE_NUMBER_INDEX + 1];
+// if (null != getSelections().get(seq)) {
+// getSelectionIndex().add(tableItemIndex);
+// }
+// }
+// if (selectionIndex.size() != 0) {
+// int[] sels = new int[selectionIndex.size()];
+// for (int i = 0; i < selectionIndex.size(); i++) {
+// sels[i] = selectionIndex.get(i);
+// }
+// table.setSelection(sels);
+// } else {
+// table.deselectAll();
+// }
+// }
}
}
return playDatas;
}
- public XmlData setPlayDatas(String file) {
- XmlData returnData = null;
+ public void setPlayDatas(String file) {
String fileName = file;
DocumentBuilder builder = null;
Document doc = null;
e.printStackTrace();
}
+ if (null == doc) {
+ return;
+ }
NodeList eventDatas = doc.getElementsByTagName(StrEventData);
Node eventData = null;
int eventDataLength = eventDatas.getLength();
eventData = eventDatas.item(i);
playDatas.add(getEventDataFromFile(eventData.getChildNodes()));
}
- return returnData;
}
public XmlData setEvent(String line, long time) {
XmlData eventData = new XmlData();
- String[] eventDatas = line.trim().split(AnalyzerConstants.DATA_PARSING_TOKEN);
+ String[] eventDatas = line.trim().split(
+ AnalyzerConstants.DATA_PARSING_TOKEN);
if (eventDatas.length < 7) {
return null;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.ErrorCode;
+import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
public class UIRecorderPlayThread extends Thread {
private static UIRecorderPlayThread instance = null;
private String xmlFileName = null;
- boolean end = false;
-
public static UIRecorderPlayThread getInstance() {
return instance;
}
+ recordEvent.length() + "|" + recordEvent;
if (!replayEvent.contains(FILTER_STRING)) {
- String result = DACommunicator
+ HostResult result = DACommunicator
.handleControlMessage(replayEvent);
- if (null != result) {
- System.out.println("replay message ack :" + result);
- String[] splitResult = result
- .split(CommonConstants.CMD_SPLIT_READ);
+ if (result.isSuccess()) {
+ System.out.println("replay message ack :"
+ + result.getMessage());
+ String[] splitResult = result.getMessage().split(
+ CommonConstants.CMD_SPLIT_READ);
if (!AnalyzerConstants.MSG_OK
.equals(splitResult[ErrorCode.ERROR_MSG_INDEX])) {
-// System.out.println("replay : " + replayEvent
-// + " send failed!!");
+ // System.out.println("replay : " + replayEvent
+ // + " send failed!!");
try {
int errno = Integer
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.RealtimePerspectiveHandler;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.page.ViewAction;
public class AnalyzerUtil {
private static IWorkbenchWindow window = null;
private static String recordState = RecordStateSourceProvider.RECORD_READY;
- public static Color red, black, blue, white;
private static final int ENLARGED_LENGTH = 12;
// FIXME start
return list;
}
+ public static List<String> getFiles(String dirPath) {
+ File dir = new File(dirPath);
+ if (!dir.isDirectory()) {
+ return null;
+ }
+ String[] fileList = dir.list();
+ List<String> list = new ArrayList<String>();
+ int fileListLength = fileList.length;
+ for (int i = 0; i < fileListLength; i++) {
+ File file = new File(dirPath + File.separator + fileList[i]);
+ if (!file.isDirectory()) {
+ list.add(fileList[i]);
+ }
+ }
+
+ return list;
+ }
+
public static String getEnlargedText(String text) {
return getEnlargedText(text, ENLARGED_LENGTH);
}
public static int getTableItemHeight(Grid table) {
GC gc = new GC(table);
gc.setFont(table.getFont());
- return Math.max(0, gc.getFontMetrics().getHeight());
+ int height = Math.max(0, gc.getFontMetrics().getHeight());
+ gc.dispose();
+ gc = null;
+ return height;
}
- public static boolean isInternal(String[] input) {
+ public static boolean isInternal(ProbeCommonData log) {
if (AnalyzerConstants.CHECK_INTERNAL) {
try {
- int flag = Integer
- .parseInt(input[LogCenterConstants.INTERNAL_FLAG_INDEX]);
+ // int flag = Integer
+ // .parseInt(input[LogCenterConstants.INTERNAL_FLAG_INDEX]);
+ int flag = log.getInternalCall();
if (flag == LogCenterConstants.INTERNAL_CALL) {
return true;
} else {
return str.toString();
}
- public static String makeStringList2String(List<String> input) {
+ public static String makeStringList2String(List<Integer> input) {
if (null == input || input.isEmpty()) {
return null;
}
return str.toString();
}
- public static int checkUserCall(String[] input) {
- String internalCall = input[LogCenterConstants.LOG_USER_FUNCTION];
- if (null != internalCall && !internalCall.isEmpty()) {
- int internalValue = Integer.parseInt(internalCall);
-
- if (internalValue == AnalyzerConstants.USER_CALL) {
- return AnalyzerConstants.USER_CALL;
- } else if (internalValue == AnalyzerConstants.INTERNAL_CALL) {
- return AnalyzerConstants.INTERNAL_CALL;
- }
- }
-
- HashMap<Integer, CallStackData> cdMap = AnalyzerManager
- .getCallstackManager().getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
- .getCallstackManager().getCallStackApiByAddrMap();
-
- if (null == cdMap || null == addrMap) {
- return AnalyzerConstants.USER_CALL_CHECK_ERROR;
- }
- int seqNum = Integer
- .parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
- CallStackData csd = cdMap.get(seqNum);
- List<Long> addrs = csd.getAddrs();
- if (addrs.isEmpty() || addrs.size() < 3) {
- // FIXME
- return AnalyzerConstants.USER_CALL_CHECK_ERROR;
- }
-
- String funcName = addrMap.get(addrs.get(0)).getFunctionName();
- if (AnalyzerManager.getCallstackManager().checkUserCall(funcName)) {
- return AnalyzerConstants.USER_CALL;
- }
- return AnalyzerConstants.INTERNAL_CALL;
- }
+ // public static int checkUserCall(String[] input) {
+ // String internalCall = input[LogCenterConstants.LOG_USER_FUNCTION];
+ // if (null != internalCall && !internalCall.isEmpty()) {
+ // int internalValue = Integer.parseInt(internalCall);
+ //
+ // if (internalValue == AnalyzerConstants.USER_CALL) {
+ // return AnalyzerConstants.USER_CALL;
+ // } else if (internalValue == AnalyzerConstants.INTERNAL_CALL) {
+ // return AnalyzerConstants.INTERNAL_CALL;
+ // }
+ // }
+ //
+ // HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ // .getCallstackManager().getCallStackDataBySeqMap();
+ // HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ // .getCallstackManager().getCallStackApiByAddrMap();
+ //
+ // if (null == cdMap || null == addrMap) {
+ // return AnalyzerConstants.USER_CALL_CHECK_ERROR;
+ // }
+ // int seqNum = Integer
+ // .parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
+ // CallStackData csd = cdMap.get(seqNum);
+ // List<Long> addrs = csd.getAddrs();
+ // if (addrs.isEmpty() || addrs.size() < 3) {
+ // // FIXME
+ // return AnalyzerConstants.USER_CALL_CHECK_ERROR;
+ // }
+ //
+ // String funcName = addrMap.get(addrs.get(0)).getFunctionName();
+ // if (AnalyzerManager.getCallstackManager().checkUserCall(funcName)) {
+ // return AnalyzerConstants.USER_CALL;
+ // }
+ // return AnalyzerConstants.INTERNAL_CALL;
+ // }
public static boolean deleteFile(File file) {
if (file.isDirectory()) {
}
}
+
+ public static void checkLogs(String path, String prefix, int limitCount) {
+ List<String> logFiles = getFiles(path);
+
+ List<String> daLogFiles = new ArrayList<String>();
+ for (String name : logFiles) {
+ if (name.contains(prefix)) {
+ daLogFiles.add(name);
+ }
+ }
+
+ if (daLogFiles.size() > 3) {
+ Collections.sort(daLogFiles);
+ int to = daLogFiles.size() - limitCount;
+ for (int i = 0; i < to; i++) {
+ File deleteFile = new File(path + File.separator
+ + daLogFiles.get(i));
+ if (null != deleteFile) {
+ deleteFile(deleteFile);
+ }
+ }
+ }
+ }
+
+ private static int initIntPayload(String input) {
+ int ret;
+ try {
+ ret = Integer.parseInt(input);
+ } catch (NumberFormatException e) {
+ ret = 0;
+ }
+ return ret;
+ }
+
+ private static long initLongPayload(String input) {
+ long ret;
+ try {
+ ret = Long.parseLong(input);
+ } catch (NumberFormatException e) {
+ ret = 0;
+ }
+ return ret;
+ }
+
+ private static int getArgsCount(String input) {
+ if (null == input || input.trim().isEmpty()) {
+ return 0;
+ }
+ String[] args = input.split(CommonConstants.COMMA);
+ return args.length;
+ }
+
+ private static String initArgs(String input) {
+ if (null == input || input.isEmpty()) {
+ return null;
+ }
+ String[] args = input.split(CommonConstants.COMMA);
+ String output = "";
+ for (String str : args) {
+ if (null == str) {
+ continue;
+ }
+ output += new String('s' + str.trim() + CommonConstants.EOS);
+ }
+ return output;
+ }
+
+ public static byte[] makeByteArray(int id, String[] input) {
+ // common logs
+ String[] newLog = null;
+ byte[] result = null;
+ byte[] front = null;
+
+ if (id == AnalyzerConstants.MSG_DATA_SYSTEM) {
+ front = makeSystemData(input);
+ } else if (id == AnalyzerConstants.MSG_DATA_SAMPLE) {
+ newLog = new String[2];
+ // pid
+ newLog[0] = Integer.toString(AnalyzerManager.getProject().getPID());
+ newLog[1] = input[LogCenterConstants.PROFILING_LOG_PCADDR_INDEX];
+
+ int pid = initIntPayload(newLog[0]);
+ long pcAddr = initLongPayload(newLog[1]);
+
+ front = ByteUtils.getByte(pid, pcAddr);
+ } else {
+ if (id == AnalyzerConstants.MSG_PROBE_SCREENSHOT) {
+ System.out.println("debug ");
+ }
+ newLog = new String[10];
+ // api id
+ newLog[0] = input[LogCenterConstants.APINAME_INDEX];
+ // pid
+ newLog[1] = input[LogCenterConstants.PROCESS_ID_INDEX];
+ // tid
+ newLog[2] = input[LogCenterConstants.THREAD_ID_INDEX];
+ // args
+ newLog[3] = input[LogCenterConstants.INPUTPARM_INDEX];
+ // return
+ newLog[4] = input[LogCenterConstants.RETURN_INDEX];
+ // errno
+ newLog[5] = input[LogCenterConstants.ERROR_INDEX];
+ // internal call
+ newLog[6] = input[LogCenterConstants.INTERNAL_FLAG_INDEX];
+ // caller pc address
+ newLog[7] = input[LogCenterConstants.CALLER_PCADDR_INDEX];
+ // reserved
+ newLog[8] = CommonConstants.EMPTY;
+ // reserved
+ newLog[9] = CommonConstants.EMPTY;
+
+ int apiId = ApiNameManager.getApiId(newLog[0]);
+ int pid = initIntPayload(newLog[1]);
+ int tid = initIntPayload(newLog[2]);
+ int argsCount = getArgsCount(newLog[3]);
+ String args = initArgs(newLog[3]);
+ long ret = initLongPayload(newLog[4]);
+ long err = initLongPayload(newLog[5]);
+ int internal = initIntPayload(newLog[6]);
+ long caller = initLongPayload(newLog[7]);
+ int reserved1 = initIntPayload(newLog[8]);
+ int reserved2 = initIntPayload(newLog[9]);
+
+ front = ByteUtils.getByte(apiId, pid, tid, argsCount, args, ret,
+ err, internal, caller, reserved1, reserved2);
+ }
+
+ byte[] rear = null;
+ switch (id) {
+ case AnalyzerConstants.MSG_PROBE_MEMORY:
+ long size = Long
+ .parseLong(input[LogCenterConstants.MEMORY_SIZE_INDEX]);
+ int apiType = Integer
+ .parseInt(input[LogCenterConstants.MEMORY_APITYPE_INDEX]);
+ long address = addrToLong(input[LogCenterConstants.MEMORY_ADDR_INDEX]);
+ rear = ByteUtils.getByte(size, apiType, address);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_UICONTROL:
+ String parentName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX];
+ String parentClassName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX];
+ long parentPointer = addrToLong(input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX]);
+ String childName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX];
+ String childClassName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX];
+ long childPointer = addrToLong(input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX]);
+ rear = ByteUtils.getByte(parentName, parentClassName,
+ parentPointer, childName, childClassName, childPointer);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_UIEVENT:
+ int eventType = Integer
+ .parseInt(input[LogCenterConstants.UI_EVENT_EVENT_TYPE]);
+ int detailType = Integer
+ .parseInt(input[LogCenterConstants.UI_EVENT_DETAIL_TYPE]);
+ int x = Integer.parseInt(input[LogCenterConstants.UI_EVENT_X]);
+ int y = Integer.parseInt(input[LogCenterConstants.UI_EVENT_Y]);
+ int info1 = initIntPayload(input[LogCenterConstants.UI_EVENT_INFO1]);
+ int info2 = initIntPayload(input[LogCenterConstants.UI_EVENT_INFO2]);
+ rear = ByteUtils.getByte(eventType, detailType, x, y, info1, info2);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_FILE:
+ long sizeValue = Long
+ .parseLong(input[LogCenterConstants.RESOURCE_SIZE_INDEX]);
+ int fdValue = Integer
+ .parseInt(input[LogCenterConstants.RESOURCE_FDVALUE_INDEX]);
+ int fdType = Integer
+ .parseInt(input[LogCenterConstants.RESOURCE_FDTYPE_INDEX]);
+ int fdApiType = Integer
+ .parseInt(input[LogCenterConstants.RESOURCE_FDAPITYPE_INDEX]);
+ long fileSize = Long
+ .parseLong(input[LogCenterConstants.RESOURCE_FILE_SIZE_INDEX]);
+ String filePath = input[LogCenterConstants.RESOURCE_FILE_PATH_INDEX];
+ rear = ByteUtils.getByte(sizeValue, fdValue, fdType, fdApiType,
+ fileSize, filePath);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_LIFECYCLE:
+ result = front;
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCREENSHOT:
+ String imgFilePath = input[LogCenterConstants.SNAPSHOT_IMAGE_PATH_INDEX];
+ int orientation = Integer
+ .parseInt(input[LogCenterConstants.SNAPSHOT_ROTATE_INDEX]);
+ rear = ByteUtils.getByte(imgFilePath, orientation);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_SCENE:
+ String sceneName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX];
+ String formName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_NAME_INDEX];
+ long formPointer = Long
+ .parseLong(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX]);
+ String panelName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_NAME_INDEX];
+ long panelPointer = Long
+ .parseLong(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_POINTER_INDEX]);
+ int transitionTime = Integer
+ .parseInt(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_TRANSITION_INDEX]);
+ int userTransitionTime = Integer
+ .parseInt(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_USERTIME_INDEX]);
+ rear = ByteUtils
+ .getByte(sceneName, formName, formPointer, panelName,
+ panelPointer, transitionTime, userTransitionTime);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_DATA_SYSTEM:
+ result = front;
+ break;
+ case AnalyzerConstants.MSG_DATA_SAMPLE:
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_THREAD:
+ int pThreadId = Integer
+ .parseInt(input[LogCenterConstants.THREAD_PTHREAD_ID_INDEX]);
+ int ospThradId = Integer
+ .parseInt(input[LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX]);
+ int threadType = Integer
+ .parseInt(input[LogCenterConstants.THREAD_TYPE_INDEX]);
+ int threadApiType = Integer
+ .parseInt(input[LogCenterConstants.THREAD_API_TYPE_INDEX]);
+ rear = ByteUtils.getByte(pThreadId, ospThradId, threadType,
+ threadApiType);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_CUSTOM:
+ int handle = Integer
+ .parseInt(input[LogCenterConstants.CUSTOM_CHART_HANDLE]);
+ int customType = Integer
+ .parseInt(input[LogCenterConstants.CUSTOM_CHART_TYPE]);
+ int customName = Integer
+ .parseInt(input[LogCenterConstants.CUSTOM_CHART_TEXT]);
+ int color = Integer
+ .parseInt(input[LogCenterConstants.CUSTOM_CHART_COLOR]);
+ int value = Integer
+ .parseInt(input[LogCenterConstants.CUSTOM_CHART_VALUE]);
+ rear = ByteUtils.getByte(handle, customType, customName, color,
+ value);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ case AnalyzerConstants.MSG_PROBE_SYNC:
+ long syncVal = Long
+ .parseLong(input[LogCenterConstants.SYNC_VAL_INDEX]);
+ int syncType = Integer
+ .parseInt(input[LogCenterConstants.SYNC_TYPE_INDEX]);
+ int syncApiType = Integer
+ .parseInt(input[LogCenterConstants.SYNC_API_TYPE_INDEX]);
+ rear = ByteUtils.getByte(syncVal, syncType, syncApiType);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ default:
+ // USER_FUNCTION
+ long lowPc = Long
+ .parseLong(input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_START_INDEX]);
+ long highPc = Long
+ .parseLong(input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_END_INDEX]);
+ int ufType = Integer
+ .parseInt(input[LogCenterConstants.USER_FUNCTION_TYPE_INDEX]);
+ long elapsedTime = Long
+ .parseLong(input[LogCenterConstants.USER_FUNCTION_ELAPSED_TIME_INDEX]);
+ long pcAddr = Long.parseLong(input[LogCenterConstants.PCADDR_INDEX]);
+ rear = ByteUtils.getByte(lowPc, highPc, ufType, elapsedTime, pcAddr);
+ result = ByteUtils.concatByteArray(front, rear);
+ break;
+ }
+
+ return result;
+ }
+
+ private static byte[] makeSystemData(String[] input) {
+ String[] newLog = new String[LogDataFactory
+ .getLogColumnCountbyId(AnalyzerConstants.MSG_DATA_SYSTEM)];
+ // energy
+ newLog[0] = input[LogCenterConstants.DEVICE_ENERGY_INDEX];
+ newLog[1] = input[LogCenterConstants.DEVICE_WIFI_INDEX];
+ newLog[2] = input[LogCenterConstants.DEVICE_BLUETOOTH_INDEX];
+ newLog[3] = input[LogCenterConstants.DEVICE_GPS_INDEX];
+ newLog[4] = input[LogCenterConstants.DEVICE_BRIGHTNESS_INDEX];
+ newLog[5] = input[LogCenterConstants.DEVICE_CAMERA_INDEX];
+ newLog[6] = input[LogCenterConstants.DEVICE_SOUND_INDEX];
+ newLog[7] = input[LogCenterConstants.DEVICE_AUDIO_INDEX];
+ newLog[8] = input[LogCenterConstants.DEVICE_VIBRATION_INDEX];
+ newLog[9] = input[LogCenterConstants.DEVICE_VOLTAGE_INDEX];
+ newLog[10] = input[LogCenterConstants.DEVICE_RSSI_INDEX];
+ newLog[11] = input[LogCenterConstants.DEVICE_VIDEO_INDEX];
+ newLog[12] = input[LogCenterConstants.DEVICE_CALL_INDEX];
+ newLog[13] = input[LogCenterConstants.DEVICE_DNET_INDEX];
+ newLog[14] = input[LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX];
+ newLog[15] = input[LogCenterConstants.DEVICE_APP_CPU_USAGE_INDEX];
+ newLog[16] = input[LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX];
+ newLog[17] = input[LogCenterConstants.DEVICE_VSS_MEMORY_INDEX];
+ newLog[18] = input[LogCenterConstants.DEVICE_RSS_MEMORY_INDEX];
+ newLog[19] = input[LogCenterConstants.DEVICE_SHARED_MEMORY_INDEX];
+ newLog[20] = input[LogCenterConstants.DEVICE_PSS_MEMORY_INDEX];
+ newLog[21] = input[LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX];
+ newLog[22] = input[LogCenterConstants.DEVICE_SYSTEM_TOTAL_MEMORY_INDEX];
+ newLog[23] = input[LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX];
+ newLog[24] = input[LogCenterConstants.DEVICE_SYSTEM_USED_STORAGE_INDEX];
+ newLog[25] = input[LogCenterConstants.DEVICE_THREAD_COUNT_INDEX];
+ newLog[26] = input[LogCenterConstants.DEVICE_THREAD_LOAD_INDEX];
+ newLog[27] = "1"; // process count
+ newLog[28] = "44,6.66"; // process load
+ // newLog[29] = CommonConstants.ZERO; // disk read size
+ // newLog[30] = CommonConstants.ZERO; // disk write size
+ // newLog[31] = CommonConstants.ZERO; // network send size
+ // newLog[32] = CommonConstants.ZERO; // network receive size
+ newLog[29] = "100"; // disk read size
+ newLog[30] = "200"; // disk write size
+ newLog[31] = "300"; // network send size
+ newLog[32] = "400"; // network receive size
+
+ int energy = initIntPayload(newLog[0]);
+ int wifi = initIntPayload(newLog[1]);
+ int bt = initIntPayload(newLog[2]);
+ int gps = initIntPayload(newLog[3]);
+ int brightness = initIntPayload(newLog[4]);
+ int camera = initIntPayload(newLog[5]);
+ int sound = initIntPayload(newLog[6]);
+ int audio = initIntPayload(newLog[7]);
+ int vibration = initIntPayload(newLog[8]);
+ int voltage = initIntPayload(newLog[9]);
+ int rssi = initIntPayload(newLog[10]);
+ int video = initIntPayload(newLog[11]);
+ int call = initIntPayload(newLog[12]);
+ int dnet = initIntPayload(newLog[13]);
+
+ // ***!!!!
+ String[] fr = newLog[14].split(CommonConstants.COMMA);
+ int coreCount = 0;
+ byte[] temp = new byte[0];
+ for (int i = 0; i < fr.length; i++) {
+ float f = Float.parseFloat(fr[i]);
+ temp = ByteUtils.getByte(temp, f);
+ coreCount = i + 1;
+ }
+ if (coreCount != 0) {
+ DACommunicator.getSelectedDevice().getTargetInfo()
+ .setCpuCount(coreCount);
+ }
+ byte[] cpuFrequency = new byte[temp.length];
+ System.arraycopy(temp, 0, cpuFrequency, 0, temp.length);
+
+ float appCpuUsage = Float.parseFloat(newLog[15]);
+
+ // cpu load old log : (cpu load, total load)
+ // so drop total load
+ String[] load = newLog[16].split(CommonConstants.COMMA);
+ temp = new byte[0];
+ for (int i = 0; i < load.length - 1; i++) {
+ float f = Float.parseFloat(load[i]);
+ temp = ByteUtils.getByte(temp, f);
+ }
+ byte[] cpuLoad = new byte[temp.length];
+ System.arraycopy(temp, 0, cpuLoad, 0, temp.length);
+
+ int virtualMem = initIntPayload(newLog[17]);
+ int resident = initIntPayload(newLog[18]);
+ int shared = initIntPayload(newLog[19]);
+ int pss = initIntPayload(newLog[20]);
+ int totalAlloc = initIntPayload(newLog[21]);
+ long systemTotal = initLongPayload(newLog[22]);
+ long systemUsed = initLongPayload(newLog[23]);
+ int totalUsedDrive = initIntPayload(newLog[24]);
+ int threadCount = initIntPayload(newLog[25]);
+ // TODO
+ // int threadLoad = initIntPayload(newLog[26]);
+ String[] tLoad = newLog[26].split(CommonConstants.COMMA);
+ temp = new byte[0];
+ for (int i = 0; i < tLoad.length; i += 2) {
+ int tid = Integer.parseInt(tLoad[i]);
+ float tl = Float.parseFloat(tLoad[i + 1]);
+ temp = ByteUtils.getByte(temp, tid, tl);
+ }
+ byte[] threadLoad = new byte[temp.length];
+ System.arraycopy(temp, 0, threadLoad, 0, temp.length);
+
+ int processCount = initIntPayload(newLog[27]);
+ String[] pLoad = newLog[28].split(CommonConstants.COMMA);
+ temp = new byte[0];
+ for (int i = 0; i < pLoad.length; i += 2) {
+ int tid = Integer.parseInt(pLoad[i]);
+ float tl = Float.parseFloat(pLoad[i + 1]);
+ temp = ByteUtils.getByte(temp, tid, tl);
+ }
+ byte[] procLoad = new byte[temp.length];
+ System.arraycopy(temp, 0, procLoad, 0, temp.length);
+
+ // int processLoad = initIntPayload(newLog[28]);
+ int diskRead = initIntPayload(newLog[29]);
+ int diskWrite = initIntPayload(newLog[30]);
+ int netSend = initIntPayload(newLog[31]);
+ int netRecv = initIntPayload(newLog[32]);
+
+ byte[] front = ByteUtils.getByte(energy, wifi, bt, gps, brightness,
+ camera, sound, audio, vibration, voltage, rssi, video, call,
+ dnet, cpuFrequency, appCpuUsage, cpuLoad, virtualMem, resident,
+ shared, pss, totalAlloc, systemTotal, systemUsed,
+ totalUsedDrive, threadCount, threadLoad, processCount,
+ procLoad, diskRead, diskWrite, netSend, netRecv);
+ return front;
+ }
+
+ public static long addrToLong(String hexStr) {
+
+ if (null == hexStr || hexStr.isEmpty()) {
+ return 0;
+ }
+ hexStr = hexStr.replaceFirst("^0x", CommonConstants.EMPTY);
+ long num = 0;
+ try {
+ num = Long.parseLong(hexStr.toString(), 16);
+ ;
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ return num;
+ }
}
public static void tableItemTimeFormatting(String[] input) {
String time = input[LogCenterConstants.TIME_INDEX + 1];
- String output = toTimeFormat(time);
+ String output = toTimeFormat(Long.parseLong(time));
input[LogCenterConstants.TIME_INDEX + 1] = output;
}
- public static String toTimeFormat(String time) {
- long longTime = Long.parseLong(time);
+ public static String toTimeFormat(Object time) {
+ long longTime = -1;
+ if (time instanceof Long || time instanceof Integer) {
+ longTime = (Long) time;
+ } else if (time instanceof String) {
+ longTime = Long.parseLong((String) time);
+ } else {
+ return null;
+ }
+
longTime /= 1000;
long ms = longTime % 1000;
longTime /= 1000;
return output;
}
- public static String toTimeFormat2(String msTime) {
- long longTime = Long.parseLong(msTime);
+ public static String toTimeFormat2(Object time) {
+ long longTime = -1;
+ if (time instanceof Long || time instanceof Integer) {
+ longTime = (Long) time;
+ } else if (time instanceof String) {
+ longTime = Long.parseLong((String) time);
+ } else {
+ return null;
+ }
long ms = longTime % 1000;
longTime /= 1000;
long second = longTime % 60;
String output = strSecond + "." + strMs; //$NON-NLS-1$
return output;
}
-
+
public static String toTimeFormat3(String time) {
long longTime = Long.parseLong(time);
longTime /= 1000000;
ret += " %"; //$NON-NLS-1$
return ret;
}
-
- public static String toDoubleFormat(Double input){
+
+ public static String toDoubleFormat(Double input) {
return String.format("%.2f", input); //$NON-NLS-1$
}
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.logparser.Logs;
-import org.tizen.dynamicanalyzer.model.LogCenter;
-
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogDataFactory;
public class LogParsingTest {
public void postUpdateLog(LogPackage logPack) {
- List<LogCenter> logcs = AnalyzerManager.getLogCenters();
- int size = logcs.size();
- for (int index = 0; index < size; index++)
- {
- Logs log1 = logPack.getLogs(logcs.get(index).getId());
-
- if (log1 == null)
- {
- continue;
- }
- int size1 = log1.getLogs().size();
- int size2 = logcs.get(index).getTotalColumnCount();
- StringBuffer sb = new StringBuffer();
- try {
- for (int i = 0; i < size1; i++) {
- List<String> str = log1.getLogs().get(i);
- for (int j = 0; j < size2; j++) {
- sb.append("|" + str.get(j)); //$NON-NLS-1$
- }
- System.out.println(sb.toString());
- sb.delete(0, sb.length());
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println("exception :" + sb.toString()); //$NON-NLS-1$
- e.printStackTrace();
- }
- System.out.println();
- }
+ // List<LogCenter> logcs = AnalyzerManager.getLogCenters();
+ // int size = logcs.size();
+// List<Integer> ids = LogDataFactory.getLogList();
+// int size = ids.size();
+// for (int index = 0; index < size; index++) {
+// Logs log1 = logPack.getLogs(ids.get(index));
+//
+// if (log1 == null) {
+// continue;
+// }
+// int size1 = log1.getLogs().size();
+// int size2 = logcs.get(index).getTotalColumnCount();
+// StringBuffer sb = new StringBuffer();
+// try {
+// for (int i = 0; i < size1; i++) {
+// List<String> str = log1.getLogs().get(i);
+// for (int j = 0; j < size2; j++) {
+// sb.append("|" + str.get(j)); //$NON-NLS-1$
+// }
+// System.out.println(sb.toString());
+// sb.delete(0, sb.length());
+// }
+// } catch (ArrayIndexOutOfBoundsException e) {
+// System.out.println("exception :" + sb.toString()); //$NON-NLS-1$
+// e.printStackTrace();
+// }
+// System.out.println();
+// }
}
}
+* 2.1.18
+- Refactored to sdblib
+== kh5325.kim <kh5325.kim@samsung.com> 2013-05-24
+* 2.1.16
+- Refactored to sdblib
+== kh5325.kim <kh5325.kim@samsung.com> 2013-05-22
+* 2.1.10
+- enable welcome dialogbox
+== phjwithyou.park <phjwithyou.park> 2013-04-10 21:04
+* 2.1.6
+- set log argument
+== j0.kim <j0.kim@samsung.com> 2013-03-13 14:15
+* 2.1.5
+- change welcome message
+== j0.kim <j0.kim@samsung.com> 2013-03-13 14:04
+* 2.1.4
+- da agument
+== j0.kim <j0.kim@samsung.com> 2013-03-13 13:02
+* 2.1.3
+- feature configuration dialog
+== j0.kim <j0.kim@samsung.com> 2013-03-13 11:50
+* 2.1.2
+- add feature configuration dialog
+== j0.kim <j0.kim@samsung.com> 2013-03-13 09:41
+* 2.1.1
+- package version update
+== j0.kim <j0.kim@samsung.com> 2013-03-08 16:19
+* 2.1.0
+- package version update
+== j0.kim <j0.kim@samsung.com> 2013-03-08 15:58
+* 0.3.53
+- get applist bug fixed
+== j0.kim <j0.kim@samsung.com> 2013-02-28 16:15
+* 0.3.52
+- improve logic for file and thread page.
+== j0.kim <j0.kim@samsung.com> 2013-02-20 15:08
+* 0.3.51
+- change file chart color
+== j0.kim <j0.kim@samsung.com> 2013-02-04 18:51
+* 0.3.50
+- fix command to get app list
+== j0.kim <j0.kim@samsung.com> 2013-01-23 20:24
+* 0.3.49
+- change command to get app list
+== j0.kim <j0.kim@samsung.com> 2013-01-23 19:54
+* 0.3.48
+- bug fix. open trace with snapshot
+== j0.kim <j0.kim@samsung.com> 2013-01-23 15:30
+* 0.3.47
+- change scene log
+== j0.kim <j0.kim@samsung.com> 2013-01-23 12:18
+* 0.3.46
+- add feature UI transeformTime
+== j0.kim <j0.kim@samsung.com> 2013-01-18 17:57
+* 0.3.45
+- thread page - warning added
+== j0.kim <j0.kim@samsung.com> 2013-01-16 11:52
+* 0.3.27
+- tabel selection bug fix, snapshot bug fix
+== j0.kim <j0.kim@samsung.com> 2013-01-15 21:54
+* 0.3.26
+- change path from app to developer
+== j0.kim <j0.kim@samsung.com> 2013-01-15 16:38
+* 0.3.25
+- progress bar hang bug fix
+- range selection bug fix
+== j0.kim <j0.kim@samsung.com> 2012-12-26 19:41
+* 0.3.24
+- Add MacOS Install Path
+== j0.kim <j0.kim@samsung.com> 2012-12-26 15:59
+* 0.3.23
+- da_daemon size check bug fixed
+== j0.kim <j0.kim@samsung.com> 2012-12-21 21:28
+* 0.3.22
+- calltrace view tid cloumn added
+== j0.kim <j0.kim@samsung.com> 2012-12-21 17:57
+* 0.3.21
+- Add filtering function for the open log from the application main function
+== phjwithyou.park <phjwithyou.park> 2012-12-10 16:45
+* 0.3.20
+- unknown
+== j0.kim <j0.kim@samsung.com> 2012-12-03 21:08
+* 0.3.19
+- disable frame work event;
+- apply screenshot orientation
+== j0.kim <j0.kim@samsung.com> 2012-12-03 21:03
+* 0.3.18
+- disable frame work event;
+- apply screenshot orientation
+== j0.kim <j0.kim@samsung.com> 2012-12-03 20:24
* 0.3.15
- fix checking mechanism for aliveness of daemon
== jaewon81.lim <jaewon81.lim@samsung.com> 2012-10-29 21:50
Source:dynamic-analyzer
-Version:0.3.15
+Version:2.1.19
Maintainer:Jaewon Lim <jaewon81.lim@samsung.com>, Juyoung Kim, Jooyoul lee
Package:dynamic-analyzer-product
OS:ubuntu-32
Build-host-os:ubuntu-32
Build-dependency:indigo-pde [ubuntu-32], common-eplugin [ubuntu-32]
-Install-dependency:dynamic-analysis-probe [ubuntu-32], dynamic-analysis-manager [ubuntu-32]
+Install-dependency:dynamic-analysis-manager [ubuntu-32], dynamic-analysis-ide-eplugin [ubuntu-32]
Description:Make Dynamic analyzer
Package:dynamic-analyzer-product
OS:windows-32
Build-host-os:ubuntu-32
Build-dependency:indigo-winpde [windows-32], common-eplugin [windows-32]
-Install-dependency:dynamic-analysis-probe [windows-32], dynamic-analysis-manager [windows-32]
+Install-dependency:dynamic-analysis-manager [windows-32], dynamic-analysis-ide-eplugin [windows-32]
Description:Make Dynamic analyzer
Package:dynamic-analyzer-product
OS:ubuntu-64
Build-host-os:ubuntu-64
Build-dependency:indigo-pde [ubuntu-64], common-eplugin [ubuntu-64]
-Install-dependency:dynamic-analysis-probe [ubuntu-64], dynamic-analysis-manager [ubuntu-64]
+Install-dependency:dynamic-analysis-manager [ubuntu-64], dynamic-analysis-ide-eplugin [ubuntu-64]
Description:Make Dynamic analyzer
Package:dynamic-analyzer-product
OS:windows-64
Build-host-os:ubuntu-64
Build-dependency:indigo-winpde [windows-64], common-eplugin [windows-64]
-Install-dependency:dynamic-analysis-probe [windows-64], dynamic-analysis-manager [windows-64]
+Install-dependency:dynamic-analysis-manager [windows-64], dynamic-analysis-ide-eplugin [windows-64]
Description:Make Dynamic analyzer
Package:dynamic-analyzer-product
OS:macos-64
Build-host-os:ubuntu-64
Build-dependency:indigo-macpde [macos-64], common-eplugin [macos-64]
-Install-dependency:dynamic-analysis-probe [macos-64], dynamic-analysis-manager [macos-64]
+Install-dependency:dynamic-analysis-manager [macos-64], dynamic-analysis-ide-eplugin [macos-64]
Description:Make Dynamic analyzer