|
65 | 65 | push(@lines, $section_name . "\t" . $_);
|
66 | 66 | }
|
67 | 67 |
|
68 |
| -# Sort the lines based on the third column. |
| 68 | +# Sort the lines based on the second column. |
69 | 69 | # uc() is being used to force the comparison to be case-insensitive.
|
70 | 70 | my @lines_sorted =
|
71 |
| - sort { uc((split(/\t/, $a))[2]) cmp uc((split(/\t/, $b))[2]) } @lines; |
| 71 | + sort { uc((split(/\t/, $a))[1]) cmp uc((split(/\t/, $b))[1]) } @lines; |
72 | 72 |
|
73 | 73 | # Read the sorted lines and populate the hash table
|
74 | 74 | foreach my $line (@lines_sorted)
|
75 | 75 | {
|
76 | 76 | die "unable to parse wait_event_names.txt for line $line\n"
|
77 |
| - unless $line =~ /^(\w+)\t+(\w+)\t+(\w+)\t+("\w.*\.")$/; |
| 77 | + unless $line =~ /^(\w+)\t+(\w+)\t+("\w.*\.")$/; |
78 | 78 |
|
79 |
| - ( my $waitclassname, |
80 |
| - my $waiteventenumname, |
81 |
| - my $waiteventdescription, |
82 |
| - my $waitevendocsentence) = split(/\t/, $line); |
| 79 | + (my $waitclassname, my $waiteventname, my $waitevendocsentence) = |
| 80 | + split(/\t/, $line); |
83 | 81 |
|
| 82 | + # Generate the element name for the enums based on the |
| 83 | + # description. The C symbols are prefixed with "WAIT_EVENT_". |
| 84 | + my $waiteventenumname = "WAIT_EVENT_$waiteventname"; |
| 85 | + |
| 86 | + # Build the descriptions. These are in camel-case. |
| 87 | + # LWLock and Lock classes do not need any modifications. |
| 88 | + my $waiteventdescription = ''; |
| 89 | + if ( $waitclassname eq 'WaitEventLWLock' |
| 90 | + || $waitclassname eq 'WaitEventLock') |
| 91 | + { |
| 92 | + $waiteventdescription = $waiteventname; |
| 93 | + } |
| 94 | + else |
| 95 | + { |
| 96 | + my @waiteventparts = split("_", $waiteventname); |
| 97 | + foreach my $waiteventpart (@waiteventparts) |
| 98 | + { |
| 99 | + $waiteventdescription .= substr($waiteventpart, 0, 1) |
| 100 | + . lc(substr($waiteventpart, 1, length($waiteventpart))); |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + # Store the event into the list for each class. |
84 | 105 | my @waiteventlist =
|
85 | 106 | [ $waiteventenumname, $waiteventdescription, $waitevendocsentence ];
|
86 |
| - my $trimmedwaiteventname = $waiteventenumname; |
87 |
| - $trimmedwaiteventname =~ s/^WAIT_EVENT_//; |
88 |
| - |
89 |
| - die "wait event names must start with 'WAIT_EVENT_'" |
90 |
| - if ($trimmedwaiteventname eq $waiteventenumname); |
91 | 107 | push(@{ $hashwe{$waitclassname} }, @waiteventlist);
|
92 | 108 | }
|
93 | 109 |
|
|
0 commit comments