Mercurial > emacs
annotate lisp/cedet/semantic/chart.el @ 106486:3ddc2cc2eda9
NEWS entries for mail-user-agent and CEDET.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 08 Dec 2009 02:59:53 +0000 |
parents | 7f4c7f5c0eba |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
1 ;;; semantic/chart.el --- Utilities for use with semantic tag tables |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
105340 | 3 ;; Copyright (C) 1999, 2000, 2001, 2003, 2005, 2008, 2009 |
4 ;; Free Software Foundation, Inc. | |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;;; Commentary: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; A set of simple functions for charting details about a file based on |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; the output of the semantic parser. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
104470
6ccad1511df1
Minor whitespace changes and `require' fixes.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
29 (require 'semantic) |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
30 (require 'chart) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
31 (require 'semantic/db) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
32 (require 'semantic/tag) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
33 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
34 (eval-when-compile (require 'semantic/find)) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
35 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;;; Code: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (defun semantic-chart-tags-by-class (&optional tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 "Create a bar chart representing the number of tags for a given tag class. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 Each bar represents how many toplevel tags in TAGTABLE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 exist with a given class. See `semantic-symbol->name-assoc-list' |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 for tokens which will be charted. |
105340 | 43 TAGTABLE is passed to `semantic-something-to-tag-table'." |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 (let* ((stream (semantic-something-to-tag-table |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (or tagtable (current-buffer)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (names (mapcar 'cdr semantic-symbol->name-assoc-list)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (nums (mapcar |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (lambda (symname) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (length |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (semantic-brute-find-tag-by-class (car symname) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 stream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 semantic-symbol->name-assoc-list))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (chart-bar-quickie 'vertical |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 "Semantic Toplevel Tag Volume" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 names "Tag Class" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 nums "Volume") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (defun semantic-chart-database-size (&optional tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 "Create a bar chart representing the size of each file in semanticdb. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 Each bar represents how many toplevel tags in TAGTABLE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 exist in each database entry. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 TAGTABLE is passed to `semantic-something-to-tag-table'." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (interactive) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
67 (unless (and (fboundp 'semanticdb-minor-mode-p) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
68 (semanticdb-minor-mode-p)) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
69 (error "Semanticdb is not enabled")) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (let* ((db semanticdb-current-database) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (dbt (semanticdb-get-database-tables db)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (names (mapcar 'car |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (object-assoc-list |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 'file |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 dbt))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (numnuts (mapcar (lambda (dba) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (prog1 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (cons |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (if (slot-boundp dba 'tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (length (oref dba tags)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 1) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (car names)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (setq names (cdr names)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 dbt)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (nums nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (fh (/ (- (frame-height) 7) 4))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (setq numnuts (sort numnuts (lambda (a b) (> (car a) (car b))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (setq names (mapcar 'cdr numnuts) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 nums (mapcar 'car numnuts)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (if (> (length names) fh) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (progn |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (setcdr (nthcdr fh names) nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (setcdr (nthcdr fh nums) nil))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (chart-bar-quickie 'horizontal |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 "Semantic DB Toplevel Tag Volume" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 names "File" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 nums "Volume") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (defun semantic-chart-token-complexity (tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 "Calculate the `complexity' of token TOK." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (count-lines |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (semantic-tag-end tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (semantic-tag-start tok))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (defun semantic-chart-tag-complexity |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (&optional class tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 "Create a bar chart representing the complexity of some tags. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 Complexity is calculated for tags of CLASS. Each bar represents |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 the complexity of some tag in TAGTABLE. Only the most complex |
105340 | 111 items are charted. TAGTABLE is passed to |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 `semantic-something-to-tag-table'." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (let* ((sym (if (not class) 'function)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (semantic-find-tags-by-class |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 sym (semantic-something-to-tag-table (or tagtable |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (current-buffer))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (name (cond ((semantic-tag-with-position-p (car stream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (buffer-name (semantic-tag-buffer (car stream)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (t ""))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (cplx (mapcar (lambda (tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (cons tok (semantic-chart-token-complexity tok))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 stream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (namelabel (cdr (assoc 'function semantic-symbol->name-assoc-list))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (names nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (nums nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (setq cplx (sort cplx (lambda (a b) (> (cdr a) (cdr b))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (while (and cplx (<= (length names) (/ (- (frame-height) 7) 4))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (setq names (cons (semantic-tag-name (car (car cplx))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 names) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 nums (cons (cdr (car cplx)) nums) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 cplx (cdr cplx))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 ;; ;; (setq names (mapcar (lambda (str) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 ;; ;; (substring str (- (length str) 10))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 ;; ;; names)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (chart-bar-quickie 'horizontal |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (format "%s Complexity in %s" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (capitalize (symbol-name sym)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 name) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 names namelabel |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 nums "Complexity (Lines of code)") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
146 (declare-function semanticdb-get-typecache "semantic/db-typecache") |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
147 (declare-function semantic-calculate-scope "semantic/scope") |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
148 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (defun semantic-chart-analyzer () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 "Chart the extent of the context analysis." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (interactive) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
152 (require 'semantic/db-typecache) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
153 (require 'semantic/scope) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (let* ((p (semanticdb-find-translate-path nil nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (plen (length p)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (tab semanticdb-current-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (tc (semanticdb-get-typecache tab)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (tclen (+ (length (oref tc filestream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (length (oref tc includestream)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (scope (semantic-calculate-scope)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (fslen (length (oref scope fullscope))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (lvarlen (length (oref scope localvar))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (chart-bar-quickie 'vertical |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (format "Analyzer Overhead in %s" (buffer-name)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 '("includes" "typecache" "scopelen" "localvar") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 "Overhead Entries" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (list plen tclen fslen lvarlen) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 "Number of tags") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (provide 'semantic/chart) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 |
105377 | 174 ;; arch-tag: 026573b1-f4f1-4dda-ae77-b6451283ff23 |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
175 ;;; semantic/chart.el ends here |